diff --git a/unpacked/MathJax.js b/unpacked/MathJax.js index dda59b7c5..1d09ce5e9 100644 --- a/unpacked/MathJax.js +++ b/unpacked/MathJax.js @@ -2481,7 +2481,7 @@ MathJax.Hub.Startup = { MathJax.Localization = { - locale: "fr", + locale: "en", directory: "[MathJax]/localization", strings: { fr: { @@ -2491,24 +2491,61 @@ MathJax.Localization = { strings: { } }, - // FontWarnings: { - // isLoaded: true, - // strings: { - // fonts: - // [ - // ["p"], - // "MathJax peut utiliser soit les ", - // ["a",{href:"http://www.stixfonts.org/",target:"_blank"},"polices STIX"], - // " soit les ", - // ["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"},["polices TeX de MathJax"]], - // ". Téléchargez et installez une de ces familles pour rendre plus confortable votre utilisation de MathJax." - // ] - // } - // }, + FontWarnings: { + isLoaded: true, + strings: { + webFont: + "MathJax utilise les polices Web pour afficher les expressions " + + "mathématiques sur cette page. Celles-ci mettent du temps à être "+ + "téléchargées et la page serait affichée plus rapidement si vous "+ + "installiez les polices mathématiques directement dans le dossier "+ + "des polices de votre système.", + + imageFonts: + "MathJax utilise des images de caractères plutôt que les polices "+ + "Web ou locales. Ceci rend le rendu plus lent que la normale et "+ + "les expressions mathématiques peuvent ne pas s'imprimer à la "+ + "résolution maximale de votre imprimante", + + noFonts: + "MathJax n'est pas parvenu à localiser une police pour afficher "+ + "les expressions mathématiques et les images de caractères ne "+ + "sont pas disponibles. Comme solution de dernier recours, il "+ + "utilise des caractères Unicode génériques en espérant que votre "+ + "navigateur sera capable de les afficher. Certains pourront ne "+ + "être rendus de façon incorrect voire pas du tout.", + + webFonts: + "La plupart des navigateurs modernes permettent de télécharger "+ + "des polices à partir du Web. En mettant à jour pour une version "+ + "plus récente de votre navigateur (ou en changeant de navigateur) "+ + "la qualité des expressions mathématiques sur cette page pourrait "+ + "être améliorée.", + + fonts: + "%1 MathJax peut utiliser les %2 ou bien les %3. Téléchargez et"+ + "installez l'une de ces familles de polices pour améliorer votre"+ + "expérience avec MathJax.", + + PageDesigned: + "%1 Cette page est conçue pour utiliser les %2. Téléchargez "+ + " et installez ces polices pour améliorer votre expérience "+ + "avec MathJax", + + STIXfonts: + "Polices STIX", + + TeXfonts: + "Polices TeX de MathJax", + } + }, Menu: { isLoaded: true, strings: { + AboutBox: + "%1 utilisant %2", + WebkitNativeMMLWarning: "Votre navigateur ne semble pas comporter de support MathML, " + @@ -2564,7 +2601,7 @@ MathJax.Localization = { "en utilisant la commande Alt-Clic sur une expression.", NoOriginalForm: - "Aucune forme originelle", + "Aucune forme d'origine disponible.", Close: "Fermer", @@ -2572,17 +2609,46 @@ MathJax.Localization = { EqSource: "Source de l'équation MathJax" } + }, + + ConfigWarning: { + isLoaded: true, + strings: { + MissingConfig: + "%1 MathJax ne charge plus de fichier de configuration par défaut"+ + " ; vous devez spécifier ces fichiers de façons explicites. Cette"+ + " page semble utiliser l'ancien fichier de configuration par "+ + "défaut %2 and doit donc être mise à jour. Ceci est expliqué "+ + "en détails à l'addresse suivante: %3" + } + }, + + Message: { + isLoaded: true, + strings: { + LoadFailed: "Échec du chargement du fichier %1" + } } + }, + + plural: function(n) { + if (0 <= n && n < 2) return 1; // one + return 2; // other + }, + + number: function(n) { + return n.replace(".", ","); // replace dot by comma } + } }, _: function (messageId, englishPhrase) { // These variables are used in string parsing - var plural = this.plural; + var locale = this; var args = arguments; - var i, s, result; + var i, s, resultString, resultArray; function parseNextUnicodePoint(appendToResult) { @@ -2590,13 +2656,13 @@ MathJax.Localization = { if (n <= 0xD7FF || 0xE000 <= n) { // Code points U+0000 to U+D7FF and U+E000 to U+FFFF. // Append the character. - if (appendToResult) result += s[i] + if (appendToResult) resultString += s[i] i++; return; } else if (i+1 < m) { // Code points U+10000 to U+10FFFF // Append the surrogate pairs. - if (appendToResult) { result += s[i]; result += s[i+1]; } + if (appendToResult) { resultString += s[i]; resultString += s[i+1]; } i+=2 return; } @@ -2614,12 +2680,26 @@ MathJax.Localization = { i += argIndex.length; var key = +argIndex+1; if (key in args) { - if (appendToResult) { result += args[key]; } + if (appendToResult) { + var e = args[key]; + if (Array.isArray(e)) { + // if that's an array, concatenate it to the result array + resultArray.push(resultString); + resultArray = resultArray.concat(e); + resultString = ""; + } else if (typeof e === "number") { + // if that's a number, append a localized version. + resultString += locale.number(e.toString()) + } else { + // otherwise, just concatenate it to the result string + resultString += e; + } + } return true; } // invalid index: just %INTEGER and continue - if (appendToResult) { result += "%" + argIndex; } + if (appendToResult) { resultString += "%" + argIndex; } i++; return true; } @@ -2630,7 +2710,7 @@ MathJax.Localization = { if (!number) return false; // %{INTEGER} escaped integer - if (appendToResult) { result += number[1]; } + if (appendToResult) { resultString += number[1]; } i += number[0].length; return true; } @@ -2697,7 +2777,8 @@ MathJax.Localization = { s = string; i = 0; m = s.length; - result = ""; + resultString = ""; + resultArray = []; while (i < m) { if (s[i] != "%" || i+1 == m) { @@ -2716,14 +2797,16 @@ MathJax.Localization = { if (parseInteger(true)) continue; // %\{plural:%INTEGER|form1|form2 ... \} plural forms - if (parseChoiceBlock("plural", plural)) continue; + if (parseChoiceBlock("plural", locale.plural)) continue; // %CHAR: escaped character parseNextUnicodePoint(true); continue; } - return result; + if (resultArray.length == 0) return resultString; + + return resultArray; } function transformHTMLSnippet(snippet) @@ -2772,6 +2855,8 @@ MathJax.Localization = { setLocale: function(locale) { this.locale = locale; + this.plural = this.strings[locale].plural; + this.number = this.strings[locale].number; // TODO }, @@ -2784,7 +2869,11 @@ MathJax.Localization = { }, plural: function(n) { - if (n == 1) return 1; - return 2; + if (n == 1) return 1; // one + return 2; // other + }, + + number: function(n) { + return n; } }; diff --git a/unpacked/extensions/FontWarnings.js b/unpacked/extensions/FontWarnings.js index d3b21afc1..46612abac 100644 --- a/unpacked/extensions/FontWarnings.js +++ b/unpacked/extensions/FontWarnings.js @@ -1,3 +1,5 @@ +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/extensions/FontWarnings.js @@ -84,6 +86,12 @@ (function (HUB,HTML) { var VERSION = "2.1"; + + var _ = function (id) { + return MathJax.Localization._.apply(MathJax.Localization, + [ ["FontWarnings",id] ].concat([].slice.call(arguments,1)) + ); + } var CONFIG = HUB.CombineConfig("FontWarnings",{ // @@ -112,29 +120,33 @@ Message: { webFont: [ ["closeBox"], - "MathJax is using web-based fonts to display the mathematics ", - "on this page. These take time to download, so the page would ", - "render faster if you installed math fonts directly in your ", - "system's font folder.", + _("webFont", + "MathJax is using web-based fonts to display the mathematics "+ + "on this page. These take time to download, so the page would "+ + "render faster if you installed math fonts directly in your "+ + "system's font folder."), ["fonts"] ], imageFonts: [ ["closeBox"], - "MathJax is using its image fonts rather than local or web-based fonts. ", - "This will render slower than usual, and the mathematics may not print ", - "at the full resolution of your printer.", + _("imageFonts", + "MathJax is using its image fonts rather than local or web-based fonts. "+ + "This will render slower than usual, and the mathematics may not print "+ + "at the full resolution of your printer."), + ["fonts"], ["webfonts"] ], noFonts: [ ["closeBox"], - "MathJax is unable to locate a font to use to display ", - "its mathematics, and image fonts are not available, so it ", - "is falling back on generic unicode characters in hopes that ", - "your browser will be able to display them. Some characters ", - "may not show up properly, or possibly not at all.", + _("noFonts", + "MathJax is unable to locate a font to use to display "+ + "its mathematics, and image fonts are not available, so it "+ + "is falling back on generic unicode characters in hopes that "+ + "your browser will be able to display them. Some characters "+ + "may not show up properly, or possibly not at all."), ["fonts"], ["webfonts"] ] @@ -168,35 +180,37 @@ [["span",{style:{position:"relative", bottom:".2em"}},["x"]]] ]], - webfonts: [ + webFonts: [ ["p"], - "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", + "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"], - "MathJax can use either the ", - ["a",{href:"http://www.stixfonts.org/",target:"_blank"},"STIX fonts"], - " or the ", - ["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"},["MathJax TeX fonts"]], - ". Download and install either one to improve your MathJax experience." - ], + fonts: _("fonts", + "%1 MathJax can use either the %2 or the % "+ + ". Download and install either one to improve your MathJax experience.", + [["p"]], + [["a",{href:"http://www.stixfonts.org/",target:"_blank"}, + _("STIXfonts", "STIX fonts")]], + [["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"}, + [_("TeXfonts", "MathJax TeX fonts")]]] + ), - STIXfonts: [ - ["p"], - "This page is designed to use the ", - ["a",{href:"http://www.stixfonts.org/",target:"_blank"},"STIX fonts"], - ". Download and install those fonts to improve your MathJax experience." - ], - - TeXfonts: [ - ["p"], - "This page is designed to use the ", - ["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"},["MathJax TeX fonts"]], - ". Download and install those fonts to improve your MathJax experience." - ] + STIXfonts: _("PageDesigned", + "%1 This page is designed to use the %2."+ + " Download and install those fonts to improve your MathJax experience.", + [["p"]], + [["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"}, + [_("STIXfonts", "STIX fonts")]]]), + + TeXfonts: _("PageDesigned", + "%1 This page is designed to use the %2."+ + " Download and install those fonts to improve your MathJax experience.", + [["p"]], + [["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"}, + [_("TeXfonts", "MathJax TeX fonts")]]]) }, diff --git a/unpacked/extensions/MathMenu.js b/unpacked/extensions/MathMenu.js index e849171ac..0ba0af28f 100644 --- a/unpacked/extensions/MathMenu.js +++ b/unpacked/extensions/MathMenu.js @@ -622,9 +622,11 @@ MENU.About.div = MENU.Background(MENU.About); var about = HTML.addElement(MENU.About.div,"div",{ id: "MathJax_About" - },[ - ["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"], - "using "+font,["br"],["br"], + }, + _("AboutBox", "%1 using %2", + [["b",{style:{fontSize:"120%"}},["MathJax"]], + " v"+MathJax.version,["br"]], + [font,["br"],["br"], ["span",{style:{ display:"inline-block", "text-align":"left", "font-size":"80%", "max-height":"20em", overflow:"auto", @@ -635,8 +637,8 @@ src: CONFIG.closeImg, style: {width:"21px", height:"21px", position:"absolute", top:".2em", right:".2em"}, onclick: MENU.About.Remove - }] - ]); + }]]) + ); var doc = (document.documentElement||{}); var H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0; if (MENU.prototype.msieAboutBug) { diff --git a/unpacked/extensions/v1.0-warning.js b/unpacked/extensions/v1.0-warning.js index 4d375f9e1..781f338b6 100644 --- a/unpacked/extensions/v1.0-warning.js +++ b/unpacked/extensions/v1.0-warning.js @@ -26,6 +26,13 @@ (function (HUB,HTML) { var VERSION = "2.1"; + var _ = function (id) { + return MathJax.Localization._.apply( + MathJax.Localization, + [ ["ConfigWarning", id] ].concat([].slice.call(arguments,1)) + ); + }; + var CONFIG = { style: { position:"fixed", bottom:"4em", left:"3em", width:"40em", @@ -56,8 +63,13 @@ CONFIG.style.position = "absolute"; } else {delete CONFIG.style.filter} CONFIG.style.maxWidth = (document.body.clientWidth-75) + "px"; - DIV = HTML.addElement(frame,"div",{id:"MathJax_ConfigWarning",style:CONFIG.style},[ - [ + DIV = HTML.addElement(frame,"div",{id:"MathJax_ConfigWarning",style:CONFIG.style}, + _("MissingConfig", + "%1 MathJax no longer loads a default configuration file; " + + "you must specify such files explicitly. " + + "This page seems to use the older default %2 file"+ + ", and so needs to be updated. This is explained further at %3", + [[ "div",{ style: { position:"absolute", overflow:"hidden", top:".1em", right:".1em", @@ -73,18 +85,14 @@ onclick: function () {DIV.style.display = "none"} }, [["span",{style:{position:"relative", bottom:".2em"}},["x"]]] - ], - "MathJax no longer loads a default configuration file; " + - "you must specify such files explicitly. " + - "This page seems to use the older default ",["code",{},["config/MathJax.js"]], - " file, and so needs to be updated. This is explained further at", - ["p",{style:{"text-align":"center"}},[ + ]], + [["code",{},["config/MathJax.js"]]], + [["p",{style:{"text-align":"center"}},[ ["a", {href:"http://www.mathjax.org/help/configuration"}, ["http://www.mathjax.org/help/configuration"] ] - ]] - ]); + ]]])) }); })(MathJax.Hub,MathJax.HTML); diff --git a/unpacked/extensions/xxxxxxx b/unpacked/extensions/xxxxxxx new file mode 100644 index 000000000..d468ab868 --- /dev/null +++ b/unpacked/extensions/xxxxxxx @@ -0,0 +1,11 @@ +["Do this", + ["b", null, + ["now!", ["img", {src: url}]] + ] +] + +_("dothis", "Do this %1", + ["b", null, + _("now", "now! %1", ["img", {src: url}]) + ] +)