Fix a problem with localiztion when substituted value is 0. Make language menu choices be in the given language. Allow better localization of Jax/Extensions in About box. Only update langauge menu when a new language is actually loaded. Shorten a number of French menu items to improve menu appearance. Correct some problems with FontWarnings and v1.0-warning messages. Move language menu to initial MathJax menu rather than a submenu. Fix a problem with canceling selection of renderer not reseting the menu selection.
This commit is contained in:
parent
97763c94bd
commit
eeea99922b
|
@ -1059,7 +1059,7 @@ MathJax.Localization = {
|
|||
directory: "[MathJax]/localization",
|
||||
strings: {
|
||||
en: {isLoaded: true, menuTitle: "English"}, // nothing needs to be loaded for this
|
||||
fr: {menuTitle: "French"}
|
||||
fr: {menuTitle: "Fran\u00E7ais"}
|
||||
},
|
||||
|
||||
//
|
||||
|
@ -1089,12 +1089,12 @@ MathJax.Localization = {
|
|||
for (var i = 1, m = parts.length; i < m; i += 2) {
|
||||
var c = parts[i].charAt(0); // first char will be { or \d or a char to be kept literally
|
||||
if (c >= "0" && c <= "9") { // %n
|
||||
parts[i] = args[parts[i]-1] || "???";
|
||||
parts[i] = args[parts[i]-1];
|
||||
if (typeof parts[i] === "number") parts[i] = this.number(parts[i]);
|
||||
} else if (c === "{") { // %{n} or %{plural:%n|...}
|
||||
c = parts[i].substr(1);
|
||||
if (c >= "0" && c <= "9") { // %{n}
|
||||
parts[i] = args[parts[i].substr(1,parts[i].length-2)-1] || "???";
|
||||
parts[i] = args[parts[i].substr(1,parts[i].length-2)-1];
|
||||
if (typeof parts[i] === "number") parts[i] = this.number(parts[i]);
|
||||
} else { // %{plural:%n|...}
|
||||
var match = parts[i].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/);
|
||||
|
@ -1112,10 +1112,11 @@ MathJax.Localization = {
|
|||
parts[i] = "???"; // no string for this index
|
||||
}
|
||||
}
|
||||
} else {parts[i] = "%"+parts[i]} // not "plural:put back the % and leave unchanged
|
||||
} else {parts[i] = "%"+parts[i]} // not "plural", put back the % and leave unchanged
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parts[i] == null) {parts[i] = "???"}
|
||||
}
|
||||
//
|
||||
// If we are not forming a snippet, return the completed string
|
||||
|
@ -1294,15 +1295,15 @@ MathJax.Localization = {
|
|||
// Add or update a language or domain
|
||||
//
|
||||
addTranslation: function (locale,domain,definition) {
|
||||
var data = this.strings[locale];
|
||||
if (!data) {data = this.strings[locale] = {}}
|
||||
var data = this.strings[locale], isNew = false;
|
||||
if (!data) {data = this.strings[locale] = {}; isNew = true}
|
||||
if (!data.domains) {data.domains = {}}
|
||||
if (domain) {
|
||||
if (!data.domains[domain]) {data.domains[domain] = {}}
|
||||
data = data.domains[domain];
|
||||
}
|
||||
MathJax.Hub.Insert(data,definition);
|
||||
if (!domain && MathJax.Menu) {MathJax.Menu.CreateLocaleMenu()}
|
||||
if (isNew && MathJax.Menu) {MathJax.Menu.CreateLocaleMenu()}
|
||||
},
|
||||
|
||||
//
|
||||
|
|
|
@ -178,23 +178,24 @@
|
|||
[["span",{style:{position:"relative", bottom:".2em"}},["x"]]]
|
||||
]],
|
||||
|
||||
webfonts: [
|
||||
["p"],
|
||||
["webfonts",
|
||||
"Most modern browsers allow for fonts to be downloaded over the web. "+
|
||||
"Updating to a more recent version of your browser (or changing "+
|
||||
"browsers) could improve the quality of the mathematics on this page."
|
||||
]
|
||||
],
|
||||
webfonts: [
|
||||
["p"],
|
||||
["webfonts",
|
||||
"Most modern browsers allow for fonts to be downloaded over the web. "+
|
||||
"Updating to a more recent version of your browser (or changing "+
|
||||
"browsers) could improve the quality of the mathematics on this page."
|
||||
]
|
||||
],
|
||||
|
||||
fonts: [
|
||||
["p"],
|
||||
["fonts",
|
||||
"MathJax can use either the %1 or the %2",
|
||||
[["a",{href:STIXURL,target:"_blank"},[["STIXfonts","STIX fonts"]]]],
|
||||
[["a",{href:MATHJAXURL,target:"_blank"},[["TeXfonts","MathJax TeX fonts"]]]]
|
||||
]
|
||||
],
|
||||
fonts: [
|
||||
["p"],
|
||||
["fonts",
|
||||
"MathJax can use either the %1 or the %2. " +
|
||||
"Download and install one of those fonts to improve your MathJax experience.",
|
||||
[["a",{href:STIXURL,target:"_blank"},[["STIXfonts","STIX fonts"]]]],
|
||||
[["a",{href:MATHJAXURL,target:"_blank"},[["TeXfonts","MathJax TeX fonts"]]]]
|
||||
]
|
||||
],
|
||||
|
||||
// fonts: [
|
||||
// ["p"],
|
||||
|
@ -258,6 +259,8 @@
|
|||
if (data[i].length === 1 && CONFIG.HTML[data[i][0]]) {
|
||||
data.splice.apply(data,[i,1].concat(CONFIG.HTML[data[i][0]]));
|
||||
} else if (typeof data[i][1] === "string") {
|
||||
var message = MathJax.Localization.lookupPhrase(["FontWarnings",data[i][0]],data[i][1]);
|
||||
message = MathJax.Localization.processString(message,data[i].slice(2),"FontWarnings");
|
||||
data.splice.apply(data,[i,1].concat(message));
|
||||
i += message.length;
|
||||
} else {i++}
|
||||
|
@ -265,6 +268,7 @@
|
|||
}
|
||||
DATA.div = HTMLCSS.addElement(frame,"div",
|
||||
{id:"MathJax_FontWarning",style:CONFIG.messageStyle},data);
|
||||
MathJax.Localization.setCSS(DATA.div);
|
||||
if (CONFIG.removeAfter) {
|
||||
HUB.Register.StartupHook("End",function ()
|
||||
{DATA.timer = setTimeout(FADEOUT,CONFIG.removeAfter)});
|
||||
|
|
|
@ -629,11 +629,11 @@
|
|||
HTMLCSS.allowWebFonts.replace(/otf/,"woff or otf") + " fonts");
|
||||
var jax = ["MathJax.js v"+MathJax.fileversion,["br"]];
|
||||
jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);
|
||||
MENU.About.GetJax(jax,MathJax.InputJax,_("InputJax","Input Jax"));
|
||||
MENU.About.GetJax(jax,MathJax.OutputJax,_("OutputJax","Output Jax"));
|
||||
MENU.About.GetJax(jax,MathJax.ElementJax,_("ElementJax","Element Jax"));
|
||||
MENU.About.GetJax(jax,MathJax.InputJax,["InputJax","%1 Input Jax v%2"]);
|
||||
MENU.About.GetJax(jax,MathJax.OutputJax,["OutputJax","%1 Output Jax v%2"]);
|
||||
MENU.About.GetJax(jax,MathJax.ElementJax,["ElementJax","%1 Element Jax v%2"]);
|
||||
jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);
|
||||
MENU.About.GetJax(jax,MathJax.Extension,_("Extension","Extension"),true);
|
||||
MENU.About.GetJax(jax,MathJax.Extension,["Extension","%1 Extension v%2"],true);
|
||||
jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[
|
||||
HUB.Browser + " v"+HUB.Browser.version + (format ?
|
||||
" \u2014 " + _(format.replace(/ /g,""),format) : "")
|
||||
|
@ -675,7 +675,7 @@
|
|||
var info = [];
|
||||
for (var id in JAX) {if (JAX.hasOwnProperty(id) && JAX[id]) {
|
||||
if ((noTypeCheck && JAX[id].version) || (JAX[id].isa && JAX[id].isa(JAX)))
|
||||
{info.push((JAX[id].id||id)+" "+type+" v"+JAX[id].version)}
|
||||
{info.push(_(type[0],type[1],(JAX[id].id||id),JAX[id].version))}
|
||||
}}
|
||||
info.sort();
|
||||
for (var i = 0, m = info.length; i < m; i++) {jax.push(info[i],["br"])}
|
||||
|
@ -831,8 +831,13 @@
|
|||
message += _("SwitchAnyway",
|
||||
"Switch the renderer anyway?\n\n" +
|
||||
"(Press OK to switch, CANCEL to continue with the current renderer)");
|
||||
MENU.cookie.renderer = jax[0].id; MENU.saveCookie(); if (!confirm(message)) {return}
|
||||
if (warned) {MENU.cookie[warned] = CONFIG.settings[warned] = true}
|
||||
MENU.cookie.renderer = jax[0].id; MENU.saveCookie();
|
||||
if (!confirm(message)) {
|
||||
MENU.cookie.renderer = CONFIG.settings.renderer = HTML.Cookie.Get("menu").renderer;
|
||||
MENU.saveCookie();
|
||||
return;
|
||||
}
|
||||
if (warned) {MENU.cookie.warned = CONFIG.settings.warned = true}
|
||||
MENU.cookie.renderer = CONFIG.settings.renderer; MENU.saveCookie();
|
||||
}
|
||||
HUB.Queue(
|
||||
|
@ -1042,13 +1047,12 @@
|
|||
),
|
||||
ITEM.COMMAND(["Scale","Scale All Math ..."],MENU.Scale),
|
||||
ITEM.RULE().With({hidden:!CONFIG.showDiscoverable, name:["","discover_rule"]}),
|
||||
ITEM.CHECKBOX(["Discoverable","Highlight on Hover"], "discoverable", {hidden:!CONFIG.showDiscoverable}),
|
||||
ITEM.RULE().With({hidden:!CONFIG.showLocale, name:["","locale_rule"]}),
|
||||
ITEM.SUBMENU(["Locale","Locale"], {hidden:!CONFIG.showLocale},
|
||||
ITEM.RADIO("en", "locale", {action: MENU.Locale}),
|
||||
ITEM.RULE(),
|
||||
ITEM.COMMAND(["LoadLocale","Load from URL ..."], MENU.LoadLocale)
|
||||
)
|
||||
ITEM.CHECKBOX(["Discoverable","Highlight on Hover"], "discoverable", {hidden:!CONFIG.showDiscoverable})
|
||||
),
|
||||
ITEM.SUBMENU(["Locale","Language"], {hidden:!CONFIG.showLocale},
|
||||
ITEM.RADIO("en", "locale", {action: MENU.Locale}),
|
||||
ITEM.RULE(),
|
||||
ITEM.COMMAND(["LoadLocale","Load from URL ..."], MENU.LoadLocale)
|
||||
),
|
||||
ITEM.RULE(),
|
||||
ITEM.COMMAND(["About","About MathJax"],MENU.About),
|
||||
|
@ -1075,7 +1079,7 @@
|
|||
// Creates the locale menu from the list of locales in MathJax.Localization.strings
|
||||
//
|
||||
MENU.CreateLocaleMenu = function () {
|
||||
var menu = MENU.menu.Find("Math Settings","Locale").menu, items = menu.items;
|
||||
var menu = MENU.menu.Find("Language").menu, items = menu.items;
|
||||
//
|
||||
// Get the names of the languages and sort them
|
||||
//
|
||||
|
@ -1120,8 +1124,7 @@
|
|||
};
|
||||
MENU.showLocale = function (show) {
|
||||
MENU.cookie.showLocale = CONFIG.showLocale = show; MENU.saveCookie();
|
||||
MENU.menu.Find("Math Settings","Locale").hidden = !show;
|
||||
MENU.menu.Find("Math Settings","locale_rule").hidden = !show;
|
||||
MENU.menu.Find("Language").hidden = !show;
|
||||
};
|
||||
|
||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
"MathJax no longer loads a default configuration file; " +
|
||||
"you must specify such files explicitly. " +
|
||||
"This page seems to use the older default %1 " +
|
||||
"file, and so needs to be updated. This is explained further at %1",
|
||||
"file, and so needs to be updated. This is explained further at %2",
|
||||
[["code",{},["config/MathJax.js"]]],
|
||||
[["p",{style:{"text-align":"center"}},[
|
||||
["a",
|
||||
|
@ -95,6 +95,7 @@
|
|||
]
|
||||
])
|
||||
);
|
||||
MathJax.Localization.setCSS(DIV);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@ MathJax.Localization.addTranslation("fr","MathMenu",{
|
|||
isLoaded: true,
|
||||
strings: {
|
||||
|
||||
Show: "Afficher la formule sous forme",
|
||||
Show: "Afficher sous forme",
|
||||
MathMLcode: "de code MathML",
|
||||
OriginalMathML: "de code MathML originel",
|
||||
TeXCommands: "de commandes TeX",
|
||||
AsciiMathInput: "de code AsciiMathML",
|
||||
Original: "originelle",
|
||||
ErrorMessage: "de message d'erreur",
|
||||
texHints: "Afficher les indications TeX dans le code MathML",
|
||||
Settings: "Paramètres des formules",
|
||||
ZoomTrigger: "Déclenchement du zoom par",
|
||||
texHints: "Inclure les données TeX dans le MathML",
|
||||
Settings: "Paramètres",
|
||||
ZoomTrigger: "Déclenchement du zoom",
|
||||
Hover: "Survol de la souris",
|
||||
Click: "Clic de souris",
|
||||
DoubleClick: "Double-clic",
|
||||
NoZoom: "Pas de zoom",
|
||||
TriggerRequires: "Le déclenchement nécessite l'appui sur la touche",
|
||||
TriggerRequires: "Le déclenchement nécessite la touche",
|
||||
Option: "Option",
|
||||
Alt: "Alt",
|
||||
Command: "Command",
|
||||
|
@ -37,12 +37,10 @@ MathJax.Localization.addTranslation("fr","MathMenu",{
|
|||
STIXLocal: "STIX (locales)",
|
||||
ContextMenu: "Menu contextuel",
|
||||
Browser: "Navigateur",
|
||||
Scale: "Mise à l'échelle des formules ...",
|
||||
Scale: "Mise à l'échelle ...",
|
||||
Discoverable: "Mettez en surbrillance lors du survol",
|
||||
Locale: "Langue",
|
||||
en: "Anglais (en)",
|
||||
fr: "Français (fr)",
|
||||
LoadLocale: "Charger à partir d'une adresse URL...",
|
||||
Locale: "Langue",
|
||||
LoadLocale: "Charger à partir de l'URL...",
|
||||
About: "À propos de MathJax",
|
||||
Help: "Aide MathJax",
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user