commit 4fdb68a0804e6734cfb891a91909b85bcbecee49
parent d71498ee256e137e4691586f2b10e68429015d82
Author: Frédéric Wang <fred.wang@free.fr>
Date: Fri, 22 Feb 2013 13:56:52 +0100
More attempts to translate messages.
Diffstat:
10 files changed, 155 insertions(+), 36 deletions(-)
diff --git a/unpacked/MathJax.js b/unpacked/MathJax.js
@@ -882,7 +882,10 @@ MathJax.fileversion = "2.1";
// The default error hook for file load failures
//
loadError: function (file) {
- BASE.Message.Set("File failed to load: "+file,null,2000);
+ BASE.Message.Set(
+ BASE.Localization._(["Message", "LoadFailed"],
+ "File failed to load: %1", file),
+ null,2000);
BASE.Hub.signal.Post(["file load error",file]);
},
@@ -1758,9 +1761,10 @@ MathJax.Hub.Startup = {
var user = MathJax.HTML.Cookie.Get("user");
if (user.URL || user.Config) {
if (confirm(
- "MathJax has found a user-configuration cookie that includes code to be run. " +
- "Do you want to run it?\n\n"+
- "(You should press Cancel unless you set up the cookie yourself.)"
+ MathJax.Localization._("CookieConfig",
+ "MathJax has found a user-configuration cookie that includes code to"+
+ "be run. Do you want to run it?\n\n"+
+ "(You should press Cancel unless you set up the cookie yourself.)")
)) {
if (user.URL) {this.queue.Push(["Require",MathJax.Ajax,user.URL])}
if (user.Config) {this.queue.Push(new Function(user.Config))}
@@ -2488,9 +2492,28 @@ MathJax.Localization = {
isLoaded: true,
domains: {
"_": {
+ isLoaded: true,
strings: {
+ CookieConfie:
+ "MathJax a trouvé un cookie de configuration utilisateur qui inclut"+
+ "du code à exécuter. Souhaitez vous l'exécuter?\n\n"+
+ "(Choisissez Annuler sauf si vous avez créé ce cookie vous-même",
}
},
+ Message: {
+ LoadFailed: "Échec du téléchargement de %1",
+ CantLoadWebFont: "Impossible de télécharcharger la police Web %1",
+ FirefoxCantLoadWebFont:
+ "Firefox ne peut télécharger les polices Web à partir d'un hôte"+
+ "distant",
+ CantFindFontUsing:
+ "Impossible de trouver une police valide en utilisant %1",
+ WebFontsNotAvailable:
+ "Polices Web non disponibles -- des images de caractères vont être"+
+ "utilisées à la place",
+ MathJaxNotSupported:
+ "Votre navigateur ne supporte pas MathJax"
+ },
FontWarnings: {
isLoaded: true,
strings: {
@@ -2623,10 +2646,33 @@ MathJax.Localization = {
}
},
- Message: {
+ MathML: {
isLoaded: true,
strings: {
- LoadFailed: "Échec du chargement du fichier %1"
+ BadMglyph: "Élement mglyph incorrect: %1",
+ BadMglyphFont: "Police de caractère incorrecte: %1"
+ MathPlayer:
+ "MathJax n'est pas parvenu à configurer MathPlayer.\n\n"+
+ "Vous devez d'abord installer MathPlayer. Si c'est déjà le cas,\n"+
+ "vos paramètres de sécurités peuvent empêcher l'exécution des\n"+
+ "contrôles ActiveX. Sélectionnez Options Internet dans le menu\n"+
+ "Outils et sélectionnez l'onglet Sécurité. Appuyez ensuite sur\n"+
+ "le menu Niveau Personalisé. Assurez vous que les paramètres\n"+
+ "Exécution des contrôles ActiveX et Comportements des exécutables\n"+
+ "et des scripts sont activés.\n\n"+
+ "Actuellement, vous verez des messages d'erreur à la place des"+
+ "expressions mathématiques.",
+ CantCreateXMLParser:
+ "MathJax ne peut créer un analyseur grammatical XML pour le MathML",
+ UnknownNodeType: "Type de noeud inconnu: %1",
+ UnexpectedTextNode: "Noeud de texte inattendu: %1",
+ ErrorParsingMathML:
+ "Erreur lors de l'analyse grammaticale du code MathML",
+ MathMLSingleElement:
+ "Le code MathML doit être formé d'un unique élément",
+ MathMLRootElement:
+ "Le code MathML doit être formé d'un élément <math> et non un"+
+ "élément %1"
}
}
},
diff --git a/unpacked/extensions/v1.0-warning.js b/unpacked/extensions/v1.0-warning.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/v1.0-warning.js
@@ -64,6 +66,9 @@
} else {delete CONFIG.style.filter}
CONFIG.style.maxWidth = (document.body.clientWidth-75) + "px";
DIV = HTML.addElement(frame,"div",{id:"MathJax_ConfigWarning",style:CONFIG.style},
+ // Localization:
+ // - decide HTML snippet format
+ // - how do we ensure it is updated when the language is changed?
_("MissingConfig",
"%1 MathJax no longer loads a default configuration file; " +
"you must specify such files explicitly. " +
diff --git a/unpacked/extensions/xxxxxxx b/unpacked/extensions/xxxxxxx
@@ -1,11 +0,0 @@
-["Do this",
- ["b", null,
- ["now!", ["img", {src: url}]]
- ]
-]
-
-_("dothis", "Do this %1",
- ["b", null,
- _("now", "now! %1", ["img", {src: url}])
- ]
-)
diff --git a/unpacked/jax/input/MathML/jax.js b/unpacked/jax/input/MathML/jax.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/jax/input/MathML/jax.js
@@ -26,6 +28,11 @@
(function (MATHML,BROWSER) {
var MML;
+ var _ = function (id) {
+ return MathJax.Localization._.apply(MathJax.Localization,[
+ ["MathML",id] ].concat([].slice.call(arguments,1)))
+ };
+
MATHML.Parse = MathJax.Object.Subclass({
Init: function (string) {this.Parse(string)},
@@ -46,18 +53,35 @@
}
math = math.replace(/^\s*(?:\/\/)?<!(--)?\[CDATA\[((.|\n)*)(\/\/)?\]\]\1>\s*$/,"$2");
math = math.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity);
- doc = MATHML.ParseXML(math); if (doc == null) {MATHML.Error("Error parsing MathML")}
+ doc = MATHML.ParseXML(math);
+ if (doc == null) {
+ MATHML.Error(_("ErrorParsingMathML", "Error parsing MathML"))
+ }
}
var err = doc.getElementsByTagName("parsererror")[0];
+ // Localization: This seems to replace error messages produced
+ // by browsers. Does that work in all languages?
if (err) MATHML.Error("Error parsing MathML: "+err.textContent.replace(/This page.*?errors:|XML Parsing Error: |Below is a rendering of the page.*/g,""));
- if (doc.childNodes.length !== 1) MATHML.Error("MathML must be formed by a single element");
+ if (doc.childNodes.length !== 1) {
+ MATHML.Error(
+ _("MathMLSingleElement", "MathML must be formed by a single element")
+ );
+ }
if (doc.firstChild.nodeName.toLowerCase() === "html") {
var h1 = doc.getElementsByTagName("h1")[0];
if (h1 && h1.textContent === "XML parsing error" && h1.nextSibling)
+ // Localization: This seems to replace error messages produced
+ // by browsers. Does that work in all languages?
MATHML.Error("Error parsing MathML: "+String(h1.nextSibling.nodeValue).replace(/fatal parsing error: /,""));
}
- if (doc.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"") !== "math")
- MATHML.Error("MathML must be formed by a <math> element, not <"+doc.firstChild.nodeName+">");
+ if (doc.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"") !==
+ "math") {
+ MATHML.Error(
+ _("MathMLRootElement",
+ "MathML must be formed by a <math> element, not %1",
+ "<"+doc.firstChild.nodeName+">")
+ );
+ }
this.mml = this.MakeMML(doc.firstChild);
},
@@ -72,7 +96,10 @@
mml = this.TeXAtom(match[2]);
} else if (!(MML[type] && MML[type].isa && MML[type].isa(MML.mbase))) {
MathJax.Hub.signal.Post(["MathML Jax - unknown node type",type]);
- return MML.merror("Unknown node type: "+type);
+ return MML.merror(
+ MathJax.Localization._(
+ "UnknownNodeType", "Unknown node type: %1", type)
+ );
} else {
mml = MML[type]();
}
@@ -148,7 +175,10 @@
var text = child.nodeValue.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity);
mml.Append(MML.chars(this.trimSpace(text)));
} else if (child.nodeValue.match(/\S/)) {
- MATHML.Error("Unexpected text node: '"+child.nodeValue+"'");
+ MATHML.Error(
+ _("UnexpectedTextNode", "Unexpected text node: %1",
+ "'"+child.nodeValue+"'")
+ );
}
} else if (mml.type === "annotation-xml") {
mml.Append(MML.xml(child));
diff --git a/unpacked/jax/input/TeX/jax.js b/unpacked/jax/input/TeX/jax.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/jax/input/TeX/jax.js
@@ -72,8 +74,9 @@
var STACKITEM = STACK.Item = MathJax.Object.Subclass({
type: "base",
- closeError: "Extra close brace or missing open brace",
- rightError: "Missing \\left or extra \\right",
+ // Localization: should be updated when the language is changed
+ closeError: _("closeError", "Extra close brace or missing open brace"),
+ rightError: _("rightError", "Missing \\left or extra \\right"),
Init: function () {
if (this.isOpen) {this.env = {}}
this.data = [];
diff --git a/unpacked/jax/output/HTML-CSS/autoload/mglyph.js b/unpacked/jax/output/HTML-CSS/autoload/mglyph.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/jax/output/HTML-CSS/autoload/mglyph.js
@@ -39,7 +41,11 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
if (HTMLCSS.Font.testFont(font)) {
this.HTMLhandleVariant(span,variant,String.fromCharCode(index));
} else {
- if (values.alt === "") {values.alt = "Bad font: "+font.family}
+ if (values.alt === "") {
+ values.alt =
+ MathJax.Localization._(["MathML", "BadMglyphFont"],
+ "Bad font: %1", font.family);
+ }
err = MML.merror(values.alt).With({mathsize:"75%"});
this.Append(err); err.toHTML(span); this.data.pop();
span.bbox = err.HTMLspanElement().bbox;
@@ -57,7 +63,10 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
MathJax.Hub.RestartAfter(img.onload);
}
if (this.img.status !== "OK") {
- err = MML.merror("Bad mglyph: "+values.src).With({mathsize:"75%"});
+ err = MML.merror(
+ MathJax.Localization._(["MathML", "BadMglyph"],
+ "Bad mglyph: %1", values.src)
+ ).With({mathsize:"75%"});
this.Append(err); err.toHTML(span); this.data.pop();
span.bbox = err.HTMLspanElement().bbox;
} else {
diff --git a/unpacked/jax/output/HTML-CSS/config.js b/unpacked/jax/output/HTML-CSS/config.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/jax/output/HTML-CSS/config.js
@@ -145,7 +147,10 @@ MathJax.Hub.Register.StartupHook("End Config",[function (HUB,HTMLCSS) {
!HUB.Browser.versionAtLeast(CONFIG.minBrowserVersion[HUB.Browser]||0.0)) {
HTMLCSS.Translate = CONFIG.minBrowserTranslate;
HUB.Config({showProcessingMessages: false});
- MathJax.Message.Set("Your browser does not support MathJax",null,4000);
+ MathJax.Message.Set(
+ MathJax.Localization._(["Message", "MathJaxNotSupported"],
+ "Your browser does not support MathJax"),
+ null,4000);
HUB.Startup.signal.Post("MathJax not supported");
}
diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.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/jax/output/HTML-CSS/jax.js
@@ -129,7 +131,12 @@
loadWebFont: function (font) {
HUB.Startup.signal.Post("HTML-CSS Jax - Web-Font "+HTMLCSS.fontInUse+"/"+font.directory);
- var n = MathJax.Message.File("Web-Font "+HTMLCSS.fontInUse+"/"+font.directory);
+ var n = MathJax.Message.File(
+ // Localization: Message.File(fileName) will write "Loading "+fileName
+ // Here, this will become "Loading Web-Font "+fileName. Does it work
+ // for all languages (word order might be different)?
+ "Web-Font "+HTMLCSS.fontInUse+"/"+font.directory
+ );
var done = MathJax.Callback({}); // called when font is loaded
var callback = MathJax.Callback(["loadComplete",this,font,n,done]);
AJAX.timer.start(AJAX,[this.checkWebFont,font,callback],0,this.timeout);
@@ -149,11 +156,17 @@
if (!this.webFontLoaded) {HTMLCSS.loadWebFontError(font,done)} else {done()}
},
loadError: function (font) {
- MathJax.Message.Set("Can't load web font "+HTMLCSS.fontInUse+"/"+font.directory,null,2000);
+ MathJax.Message.Set(
+ MathJax.Localization._("Message", "CantLoadWebFont",
+ "Can't load web font %1", HTMLCSS.fontInUse+"/"+font.directory),
+ null,2000);
HUB.Startup.signal.Post(["HTML-CSS Jax - web font error",HTMLCSS.fontInUse+"/"+font.directory,font]);
},
firefoxFontError: function (font) {
- MathJax.Message.Set("Firefox can't load web fonts from a remote host",null,3000);
+ MathJax.Message.Set(
+ MathJax.Localization._(["Message", "FirefoxCantLoadWebFont"],
+ "Firefox can't load web fonts from a remote host"),
+ null,3000);
HUB.Startup.signal.Post("HTML-CSS Jax - Firefox web fonts on remote host error");
},
@@ -321,7 +334,11 @@
HUB.Startup.signal.Post("HTML-CSS Jax - using image fonts");
}
} else {
- MathJax.Message.Set("Can't find a valid font using ["+this.config.availableFonts.join(", ")+"]",null,3000);
+ MathJax.Message.Set(
+ MathJax.Localization._(["Message", "CantFindFontUsing"],
+ "Can't find a valid font using %1",
+ "["+this.config.availableFonts.join(", ")+"]"),
+ null,3000);
this.FONTDATA = {
TeX_factor: 1, baselineskip: 1.2, lineH: .8, lineD: .2, ffLineH: .8,
FONTS: {}, VARIANT: {normal: {fonts:[]}}, RANGES: [],
@@ -1469,7 +1486,10 @@
this.imgFonts = true;
HUB.Startup.signal.Post("HTML-CSS Jax - switch to image fonts");
HUB.Startup.signal.Post("HTML-CSS Jax - using image fonts");
- MathJax.Message.Set("Web-Fonts not available -- using image fonts instead",null,3000);
+ MathJax.Message.Set(
+ MathJax.Localization._(["Message", "WebFontNotAvailable"],
+ "Web-Fonts not available -- using image fonts instead"),
+ null,3000);
AJAX.Require(this.directory+"/imageFonts.js",done);
} else {
this.allowWebFonts = false;
diff --git a/unpacked/jax/output/NativeMML/jax.js b/unpacked/jax/output/NativeMML/jax.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/jax/output/NativeMML/jax.js
@@ -139,7 +141,12 @@
//
// If that fails, give an alert about security settings
//
- alert("MathJax was not able to set up MathPlayer.\n\n"+
+ // Localization: this seems to use "\n" to force new lines in the
+ // dialog: is it really necessary? If so, we need a localization note
+ // to explain that to localizers. Handling of concatenation might
+ // be an additional difficulty for the string extractor.
+ alert(_MathJax.Localization._(["MathML", "MathPlayer"],
+ "MathJax was not able to set up MathPlayer.\n\n"+
"If MathPlayer is not installed, you need to install it first.\n"+
"Otherwise, your security settings may be preventing ActiveX \n"+
"controls from running. Use the Internet Options item under\n"+
@@ -148,7 +155,7 @@
"'Run ActiveX Controls', and 'Binary and script behaviors'\n"+
"are enabled.\n\n"+
"Currently you will see error messages rather than\n"+
- "typeset mathematics.");
+ "typeset mathematics."));
}
} else {
//
diff --git a/unpacked/jax/output/SVG/autoload/mglyph.js b/unpacked/jax/output/SVG/autoload/mglyph.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/jax/output/SVG/autoload/mglyph.js
@@ -70,7 +72,10 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
MathJax.Hub.RestartAfter(img.onload);
}
if (this.img.status !== "OK") {
- err = MML.merror("Bad mglyph: "+values.src).With({mathsize:"75%"});
+ err = MML.merror(
+ MathJax.Localization._(["MathML", "BadMglyph"],
+ "Bad mglyph: %1", values.src)
+ ).With({mathsize:"75%"});
this.Append(err); svg = err.toSVG(); this.data.pop();
} else {
var mu = this.SVGgetMu(svg);