commit 0af5c438fa947790920d295e399f8f33ba641bc2
parent de34c0ec7b59c75d70ec5a96da09e218c2813d1a
Author: Frédéric Wang <fred.wang@free.fr>
Date: Thu, 8 Aug 2013 12:56:13 +0200
Fix how the locale is set from menu config / query param. #492
Diffstat:
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/unpacked/MathJax.js b/unpacked/MathJax.js
@@ -1393,9 +1393,9 @@ MathJax.Localization = {
},
//
- // Set the current language
+ // Reset the current language
//
- setLocale: function(locale) {
+ resetLocale: function(locale) {
// Selection algorithm:
// 1) Downcase locale name (e.g. "en-US" => "en-us")
// 2) Try a parent language (e.g. "en-us" => "en")
@@ -1410,6 +1410,13 @@ MathJax.Localization = {
}
var remap = this.strings[locale].remap;
this.locale = remap ? remap : locale;
+ },
+
+ //
+ // Set the current language
+ //
+ setLocale: function(locale) {
+ this.resetLocale(locale);
if (MathJax.Menu) {this.loadDomain("MathMenu")}
},
@@ -2297,7 +2304,7 @@ MathJax.Hub.Startup = {
// set the locale and the default menu value for the locale
//
if (this.params.locale) {
- MathJax.Localization.locale = this.params.locale;
+ MathJax.Localization.resetLocale(this.params.locale);
MathJax.Hub.config.menuSettings.locale = this.params.locale;
}
//
@@ -2375,7 +2382,7 @@ MathJax.Hub.Startup = {
["Get",MathJax.HTML.Cookie,"menu",MathJax.Hub.config.menuSettings],
[function (config) {
if (config.menuSettings.locale)
- {MathJax.Localization.locale = config.menuSettings.locale}
+ {MathJax.Localization.resetLocale(config.menuSettings.locale)}
var renderer = config.menuSettings.renderer, jax = config.jax;
if (renderer) {
var name = "output/"+renderer; jax.sort();