From: Stephen Cameron Date: Wed, 1 Aug 2018 12:24:49 +0000 (+0200) Subject: WIP #2170 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=26caac736a8b921547f096442830390276acb435;p=fluidbook-html5.git WIP #2170 @2 --- diff --git a/js/libs/fluidbook/fluidbook.l10n.js b/js/libs/fluidbook/fluidbook.l10n.js index 4990c818..de956fe2 100644 --- a/js/libs/fluidbook/fluidbook.l10n.js +++ b/js/libs/fluidbook/fluidbook.l10n.js @@ -97,7 +97,8 @@ FluidbookL10N.prototype = { var o = {lang: l[0], flag: l[1], url: url, langName: l[3], countryName: l[4]}; // $this.multilang[$this.multilang.length] = o; - $this.multilang[l[0]] = o; // Indexed by language code to allow easier lookups later + var languageID = l[0] + '_' + l[1]; + $this.multilang[languageID] = o; // Indexed by language code + flag to allow easier lookups later and allow multiple variations of the same language }); }, getActiveFlag: function () { @@ -133,6 +134,9 @@ FluidbookL10N.prototype = { // Format the language name according to the settings getLanguageName: function (languageCode) { + // Todo: once we have the Fluidbook country/flag avialble (see ticket #2173), we need to use that to build the language code (ie. language_country) + // Todo: check if languageCode passed in includes underscore and if not, append the country to make the full language ID matched in this.multilang + var details = this.multilang[languageCode], name = ''; @@ -190,4 +194,4 @@ FluidbookL10N.prototype = { } return this.translations[str]; } -}; \ No newline at end of file +}; diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index 65c3edb2..c6abc0d3 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -434,7 +434,9 @@ FluidbookNav.prototype = { } } else if (icon == 'lang' && this.fluidbook.l10n.multilangEnabled) { // Note: the "!" at the beginning of the title/help parameters means that we don't want these strings translated - link = this.addLink(navType, 'nav-locales', '#/locales', 'locales', '!' + this.fluidbook.l10n.getCurrentLanguageName(), '!Select Language'); + //link = this.addLink(navType, 'nav-locales', '#/locales', 'locales', '!' + this.fluidbook.l10n.getCurrentLanguageName(), '!Select Language'); + // Todo: remove this temporary link and re-instate original link above when ticket #2173 is done so we can display proper language name + link = this.addLink(navType, 'nav-locales', '#/locales', 'locales', '!Select Language', '!Select Language'); // Label says "Select Language" until we can have the country code recorded for the Fluidbook } else if (icon == 'archives') { if (this.fluidbook.datas.archivesLink != '') { link = this.addLink(navType, 'nav-archives', this.fluidbook.datas.archivesLink, 'archives', '!' + this.fluidbook.datas.archivesLabel, '!' + this.fluidbook.datas.archivesLabel);