Merge branch 'fix-default-locale-selector' of https://github.com/capilkey/bigbluebutton into capilkey-fix-default-locale-selector

This commit is contained in:
Richard Alam 2017-11-30 13:41:47 -08:00
commit 12e47d1bd6
4 changed files with 24 additions and 21 deletions

View File

@ -42,7 +42,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function changeLanguage():void {
ResourceUtil.getInstance().setPreferredLocale(selectedItem);
ResourceUtil.getInstance().setPreferredLocale(selectedItem.code);
}
]]>
</fx:Script>

View File

@ -287,7 +287,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function getTabIndexFor(chatBox:ChatTab):int {
return chatTabs.getChildIndex(chatBox);
if (chatBox)
return chatTabs.getChildIndex(chatBox);
else
return -1;
}
private function onTabNavChange():void{

View File

@ -73,7 +73,7 @@ package org.bigbluebutton.modules.screenshare.services {
}
public function disconnect():void {
conn.disconnect();
if (conn) conn.disconnect();
}
public function checkIfPresenterIsSharingScreen():void {

View File

@ -91,10 +91,9 @@ package org.bigbluebutton.util.i18n
if (preferredLocale != MASTER_LOCALE) {
LOGGER.debug("Preferred locale=" + preferredLocale + " is not the same as master locale=" + MASTER_LOCALE);
// Improve language detection
setPreferredLocale({code:preferredLocale, direction:"ltr"});
setPreferredLocale(preferredLocale);
} else {
inited = true;
dispatcher.dispatchEvent(new LocaleChangeEvent(LocaleChangeEvent.LOCALE_INIT));
localeChangeComplete();
}
}
@ -123,12 +122,12 @@ package org.bigbluebutton.util.i18n
return ExternalInterface.call("getLanguage");
}
private function isPreferredLocaleAvailable(prefLocale:String):Boolean {
private function findPreferredLocale(prefLocale:String):Object {
for each(var item:* in locales) {
if (prefLocale == item.code)
return true;
return item;
}
return false;
return null;
}
private function getIndexForLocale(prefLocale:String):int {
@ -139,19 +138,19 @@ package org.bigbluebutton.util.i18n
return -1;
}
public function setPreferredLocale(locale:Object):void {
var localeCode : String = locale.code;
public function setPreferredLocale(localeCode:String):void {
if (localeCode == DEFAULT_LOCALE_IDENTIFIER) {
localeCode = getDefaultLocale();
}
if (isPreferredLocaleAvailable(localeCode)) {
var localeInfo:Object = findPreferredLocale(localeCode)
if (localeInfo != null) {
preferredLocale = localeCode;
}else{
preferredLocale = MASTER_LOCALE;
}
preferredDirection = locale.direction;
preferredDirection = localeInfo.direction;
changeLocale(preferredLocale);
}
@ -201,19 +200,12 @@ package org.bigbluebutton.util.i18n
changeLocaleHelper(locale);
}
private function localeChangeComplete(event:ResourceEvent):void {
private function localeChangeComplete(event:ResourceEvent=null):void {
// Set the preferred locale and master as backup.
if (preferredLocale != MASTER_LOCALE) {
ResourceManager.getInstance().localeChain = [preferredLocale, MASTER_LOCALE];
} else {
if (preferredLocale != MASTER_LOCALE) {
var logData:Object = UsersUtil.initLogData();
logData.tags = ["locale"];
logData.message = "Failed to load locale = " + preferredLocale;
LOGGER.debug(JSON.stringify(logData));
}
ResourceManager.getInstance().localeChain = [MASTER_LOCALE];
preferredLocale = MASTER_LOCALE;
}
update();
@ -225,6 +217,14 @@ package org.bigbluebutton.util.i18n
*/
private function handleResourceNotLoaded(event:ResourceEvent):void {
LOGGER.debug("Resource locale [" + preferredLocale + "] could not be loaded.");
if (preferredLocale != MASTER_LOCALE) {
var logData:Object = UsersUtil.initLogData();
logData.tags = ["locale"];
logData.message = "Failed to load locale = " + preferredLocale;
LOGGER.debug(JSON.stringify(logData));
}
ResourceManager.getInstance().localeChain = [MASTER_LOCALE];
preferredLocale = MASTER_LOCALE;
update();