included the "Default language" option to the list of languages

This commit is contained in:
Felipe Cecagno 2015-09-03 14:04:29 -03:00
parent 40ce5f8877
commit 7063cfa833
3 changed files with 32 additions and 5 deletions

View File

@ -609,6 +609,7 @@ bbb.lockSettings.feature=Feature
bbb.lockSettings.locked=Locked
bbb.lockSettings.lockOnJoin=Lock On Join
bbb.langSelector.default=Default language
bbb.langSelector.ar_SY=Arabic (Syria)
bbb.langSelector.az_AZ=Azerbaijani
bbb.langSelector.eu_EU=Basque
@ -658,4 +659,4 @@ bbb.langSelector.th_TH=Thai
bbb.langSelector.tr_TR=Turkish
bbb.langSelector.uk_UA=Ukrainian
bbb.langSelector.vi_VN=Vietnamese
bbb.langSelector.cy_GB=Welsh
bbb.langSelector.cy_GB=Welsh

View File

@ -608,6 +608,7 @@ bbb.lockSettings.feature=Recurso
bbb.lockSettings.locked=Bloqueado
bbb.lockSettings.lockOnJoin=Restringir ao entrar
bbb.langSelector.default=Idioma padrão
bbb.langSelector.ar_SY=Árabe (Síria)
bbb.langSelector.az_AZ=Azeri
bbb.langSelector.eu_EU=Basco
@ -657,4 +658,4 @@ bbb.langSelector.th_TH=Tailandês
bbb.langSelector.tr_TR=Turco
bbb.langSelector.uk_UA=Ucraniano
bbb.langSelector.vi_VN=Vietnamita
bbb.langSelector.cy_GB=Galês
bbb.langSelector.cy_GB=Galês

View File

@ -54,6 +54,7 @@ package org.bigbluebutton.util.i18n
private static var BBB_RESOURCE_BUNDLE:String = 'bbbResources';
private static var MASTER_LOCALE:String = "en_US";
private static var DEFAULT_LOCALE_IDENTIFIER:String = "default";
[Bindable] public var locales:Array = new Array();
@ -108,6 +109,11 @@ package org.bigbluebutton.util.i18n
LogUtil.debug("--- Supported locales --- \n" + xml.toString() + "\n --- \n");
var locale:XML;
locales.push({
code: DEFAULT_LOCALE_IDENTIFIER,
name: ""
});
for each(locale in list){
locales.push({
code: locale.@code,
@ -137,6 +143,10 @@ package org.bigbluebutton.util.i18n
}
public function setPreferredLocale(locale:String):void {
if (locale == DEFAULT_LOCALE_IDENTIFIER) {
locale = getDefaultLocale();
}
LogUtil.debug("Setting up preferred locale " + locale);
if (isPreferredLocaleAvailable(locale)) {
LogUtil.debug("The locale " + locale + " is available");
@ -151,12 +161,23 @@ package org.bigbluebutton.util.i18n
private function localesCompareFunction(a:Object, b:Object):int {
var sorter:Collator = new Collator(preferredLocale, CollatorMode.SORTING);
// position the "Default language" option at the top of the list
if (a.code == DEFAULT_LOCALE_IDENTIFIER) {
return -1;
}
if (b.code == DEFAULT_LOCALE_IDENTIFIER) {
return 1;
}
return sorter.compare(a.name, b.name);
}
private function reloadLocaleNames():void {
for each (var item:* in locales) {
item.name = ResourceUtil.getInstance().getString("bbb.langSelector." + item.code, null, preferredLocale);
if (item.code == DEFAULT_LOCALE_IDENTIFIER) {
item.name = ResourceUtil.getInstance().getString("bbb.langSelector." + item.code, null, getDefaultLocale());
} else {
item.name = ResourceUtil.getInstance().getString("bbb.langSelector." + item.code, null, preferredLocale);
}
}
locales.sort(localesCompareFunction);
}
@ -245,8 +266,12 @@ package org.bigbluebutton.util.i18n
* the key is available in the locale and thus not bother falling back to the master locale.
* (ralam dec 15, 2011).
*/
var localeTxt:String = resourceManager.getString(BBB_RESOURCE_BUNDLE, resourceName, parameters, null);
if ((localeTxt == "") || (localeTxt == null)) {
if (resourceManager.getObject(BBB_RESOURCE_BUNDLE, resourceName, locale) == undefined) {
locale = MASTER_LOCALE;
}
var localeTxt:String = resourceManager.getString(BBB_RESOURCE_BUNDLE, resourceName, parameters, locale);
if (locale != MASTER_LOCALE && (localeTxt == "" || localeTxt == null)) {
localeTxt = resourceManager.getString(BBB_RESOURCE_BUNDLE, resourceName, parameters, MASTER_LOCALE);
}
return localeTxt;