Unknown languages now lead to English UI. Updated documentation
on how internationalization works.
This commit is contained in:
parent
811cfd6305
commit
5ae4fb9ff4
@ -19,3 +19,10 @@ To activate playlist functionality, set one of the following attributes:
|
||||
* `list-local`: A string containing a playlist definition.
|
||||
|
||||
An arbitrary number of players can be placed on the same page.
|
||||
|
||||
|
||||
## Internationalization
|
||||
|
||||
The player defaults to English as its UI language. If the containing HTML
|
||||
document has a `lang` attribute, it is used to set the UI language in the
|
||||
player. Currently only supports English (`en`) and Swedish (`sv`).
|
||||
|
@ -1072,15 +1072,19 @@ input[type="range"]::-ms-track {
|
||||
/*
|
||||
* Get the appropriate translation of key for the language
|
||||
* stored in this._lang.
|
||||
*
|
||||
* Since the keys are in english, the key is simply returned if
|
||||
* this._lang is 'en'.
|
||||
*/
|
||||
i18n(key) {
|
||||
// Since the keys are in english, the key is simply returned if
|
||||
// this._lang is 'en'.
|
||||
if(this._lang == 'en') {
|
||||
return key;
|
||||
}
|
||||
|
||||
// If we don't have a translation for the language, use english
|
||||
if(!(this._lang in this._i18n)) {
|
||||
return key;
|
||||
}
|
||||
|
||||
return this._i18n[this._lang][key];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user