diff --git a/unpacked/MathJax.js b/unpacked/MathJax.js index d71dcba6e..f463ba82c 100644 --- a/unpacked/MathJax.js +++ b/unpacked/MathJax.js @@ -1279,8 +1279,9 @@ MathJax.Hub = { }, errorSettings: { - // Localization: should be updated when the language is changed - message: ["["+MathJax.Localization_("MathProcessingError", "Math Processing Error")+"]"], // HTML snippet structure for message to use + // Localization: not defined at that point. + // should be updated when the language is changed + message: ["[Math Processing Error]"], // HTML snippet structure for message to use style: {color: "#CC0000", "font-style":"italic"} // style for message } }, @@ -2522,6 +2523,8 @@ MathJax.Localization = { } }, Message: { + isLoaded: true, + strings: { LoadFailed: "Échec du téléchargement de %1", CantLoadWebFont: "Impossible de télécharcharger la police Web %1", FirefoxCantLoadWebFont: @@ -2534,6 +2537,7 @@ MathJax.Localization = { "utilisées à la place", MathJaxNotSupported: "Votre navigateur ne supporte pas MathJax" + } }, FontWarnings: { isLoaded: true, @@ -2693,6 +2697,10 @@ MathJax.Localization = { "Accolade fermante manquante", UndefinedControlSequence: "Commande %1 non définie", + IllegalControlSequenceName: + "Nom de contrôle de séquence non autorisé pour la commande %1", + IllegalParamNumber: + "Nombre de paramètres incorrect pour la commande %1", DoubleExponent: "Double exposant: utilisez des accolades pour clarifier", DoubleSubscripts: @@ -2700,12 +2708,15 @@ MathJax.Localization = { DoubleExponentPrime: "Un prime entraine un double exposant: utilisez"+ "des accolades pour clarifier", - CanUseHash: + CantUseHash1: "Vous ne pouvez pas utilisez le caractère #, indiquant un "+ "paramètre de macro, dans le mode mathématique", + CantUseHash2: + "Usage du caractère # non autorisé dans le modèle pour la séquence"+ + "de contrôle %1", MisplacedMiddle: "La commande %1 doit être placée à l'intérieur d'une section"+ - "\\left ... \right" + "\\left ... \right", MisplacedLimits: "La commande %1 n'est autorisée que sur les opérateurs", MisplacedMoveRoot: @@ -2724,9 +2735,11 @@ MathJax.Localization = { UnknownAttrForElement: "Attribut %1 inconnu pour l'élément %2", MaxMacroSub1: - "Le nombre maximal de substitution de macro autorisé par MathJax a été dépassé. Il y a t'il un appel de macro récursif?", + "Le nombre maximal de substitution de macro autorisé par MathJax "+ + "a été dépassé. Il y a t'il un appel de macro récursif?", MaxMacroSub2: - "Le nombre maximal de substitution de macro autorisé par MathJax a été dépassé. Il y a t'il un environnement LaTeX récursif?", + "Le nombre maximal de substitution de macro autorisé par MathJax "+ + "a été dépassé. Il y a t'il un environnement LaTeX récursif?", MissingArgFor: "Argument manquant pour la commande %1", ExtraAlignTab: @@ -2760,7 +2773,8 @@ MathJax.Localization = { IllegalMacroParam: "Paramètre de référence de macro non autorisé", MaxBufferSize: - "Taille maximale du tampon interne de MathJax dépassée. Il y a t'il un appel de macro récursif?", + "Taille maximale du tampon interne de MathJax dépassée. " + + "Il y a t'il un appel de macro récursif?", CommandNotAllowedInEnv: "La commande %1 n'est pas autorisé à l'intérieur de"+ "l'environnement %2", @@ -2772,16 +2786,53 @@ MathJax.Localization = { BadMathStyleFor: "Style mathématique non valide pour la commande %1", ErroneousNestingEq: - "Emboitement incorrect des structures d'équation" + "Emboitement incorrect des structures d'équation", MultipleRowsOneCol: - "Les lignes multiples doivent avoir exactement une colonne" + "Les lignes multiples doivent avoir exactement une colonne", NoClosingDelim: "Impossible de trouver le délimiteur fermant pour la commande %1", + NoClosingChar: + "Impossible de trouver le délimiteur '%1' fermant", MultipleBBoxProperty: "La propriété %1 de la commande %2 spécifiée deux fois", InvalidBboxProperty: "La valeur '%1' ne semble pas être une couleur, une dimension ou"+ - "de marge intérieur ou un style." + "de marge intérieur ou un style.", + ExtraEndMissingBegin: + "Commande %1 non attendue ou commande \\begingroup manquante", + GlobalNotFollowedBy: + "Command %1 non suivie d'une commande \\let, \\def ou \newcommand", + NewextarrowArg1: + "Le premier argument de la commande %1 doit être le nom d'une"+ + "séquence de contrôle", + NewextarrowArg2: + "Le second argument de la commande %1 doit être deux entiers"+ + "séparés par une virgule", + NewextarrowArg3: + "Le troisième argument de la commande %1 doit être la valeur d'un"+ + "caractère unicode", + UndefinedColorModel: + "Le modèle de couleur '%1' n'est pas défini", + rgbArg1: + "Les couleurs rgb nécéssitent 3 nombres décimaux", + InvalidDecimalNumber: "Nombre décimal non valide", + rgbArg2: "Les valeurs rgb doivent être comprises entre 0 et 1", + RGBArg1: "Les couleurs RGB nécéssitent 3 nombres", + InvalidNumber: "Nombre non valide", + RGBArg2: "Les valeurs RGB doivent être comprises entre 0 et 255", + GrayScalerArg: + "Les valeurs de dégradé de gris doivent être comprises entre 0 et 1", + DoubleBackSlash: + "\\ doit être suivi d'une séquence de contrôle", + SequentialParam: + "Les paramètres de la séquence de contrôle %1 doivent être"+ + "énumérés de façon séquentielle", + MissingReplacementString: + "Chaine de caractère de remplacement manquante pour la définition %1", + MismatchUseDef: + "L'utilisation de la commande %1 ne correspond pas à sa définition", + RunawayArgument: + "Argument manquant pour la commande %1 ?" } }, @@ -2789,7 +2840,7 @@ MathJax.Localization = { isLoaded: true, strings: { BadMglyph: "Élement mglyph incorrect: %1", - BadMglyphFont: "Police de caractère incorrecte: %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"+ diff --git a/unpacked/config/default.js b/unpacked/config/default.js index a308af5eb..008f00f31 100644 --- a/unpacked/config/default.js +++ b/unpacked/config/default.js @@ -236,8 +236,10 @@ MathJax.Hub.Config({ // jax that prevents it from operating properly). // errorSettings: { - // Localization: should be updated when the language is changed - message: ["["+MathJax.Localization._("MathProcessingError", "Math Processing Error"])+"]"], // HTML snippet structure for message to use + // Localization: + // TODO + // should be updated when the language is changed + message: ["[MathProcessingError]"], // HTML snippet structure for message to use style: {color: "#CC0000", "font-style":"italic"} // style for message }, diff --git a/unpacked/extensions/TeX/begingroup.js b/unpacked/extensions/TeX/begingroup.js index f8e831403..11126f7d9 100644 --- a/unpacked/extensions/TeX/begingroup.js +++ b/unpacked/extensions/TeX/begingroup.js @@ -215,7 +215,12 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (TEX.eqnStack.top > 1) { TEX.eqnStack.Pop(); } else if (TEX.rootStack.top === 1) { - TEX.Error("Extra "+name+" or missing \\begingroup"); + TEX.Error( + MathJax.Localization._( + ["TeX", "ExtraEndMissingBegin"], + "Extra %1 or missing \\begingroup", name + ) + ) } else { TEX.eqnStack.Clear(); TEX.rootStack.Pop(); @@ -290,8 +295,13 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { // Global: function (name) { var i = this.i; var cs = this.GetCSname(name); this.i = i; - if (cs !== "let" && cs !== "def" && cs !== "newcommand") - {TEX.Error(name+" not followed by \\let, \\def, or \\newcommand")} + if (cs !== "let" && cs !== "def" && cs !== "newcommand") { + TEX.Error( + MathJax.Localization._( + ["TeX", "GlobalNotFollowedBy"], + "%1 not followed by \\let, \\def, or \\newcommand", name) + ) + } this.stack.env.isGlobal = true; } diff --git a/unpacked/extensions/TeX/color.js b/unpacked/extensions/TeX/color.js index 0e947d10d..696e223ab 100644 --- a/unpacked/extensions/TeX/color.js +++ b/unpacked/extensions/TeX/color.js @@ -114,7 +114,12 @@ MathJax.Extension["TeX/color"] = { getColor: function (model,def) { if (!model) {model = "named"} var fn = this["get_"+model]; - if (!fn) {this.TEX.Error("Color model '"+model+"' not defined")} + if (!fn) { + this.TEX.Error( + MathJax.Localization._(["TeX", "UndefinedColorModel"], + "Color model '%1' not defined", model) + ) + } return fn.call(this,def); }, @@ -123,11 +128,24 @@ MathJax.Extension["TeX/color"] = { */ get_rgb: function (rgb) { rgb = rgb.split(/,/); var RGB = "#"; - if (rgb.length !== 3) {this.TEX.Error("rgb colors require 3 decimal numbers")} + if (rgb.length !== 3) { + this.TEX.Error(MathJax.Localization._(["TeX", "rgbArg1"], + "rgb colors require 3 decimal numbers")) + } for (var i = 0; i < 3; i++) { - if (!rgb[i].match(/^(\d+(\.\d*)?|\.\d+)$/)) {this.TEX.Error("Invalid decimal number")} + if (!rgb[i].match(/^(\d+(\.\d*)?|\.\d+)$/)) { + this.TEX.Error( + MathJax.Localization._(["TeX", "InvalidDecimalNumber"], + "Invalid decimal number") + ) + } var n = parseFloat(rgb[i]); - if (n < 0 || n > 1) {this.TEX.Error("rgb values must be between 0 and 1")} + if (n < 0 || n > 1) { + this.TEX.Error( + MathJax.Localization._(["TeX", "rgbArg2"], + "rgb values must be between 0 and 1") + ) + } n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n} RGB += n; } @@ -139,11 +157,22 @@ MathJax.Extension["TeX/color"] = { */ get_RGB: function (rgb) { rgb = rgb.split(/,/); var RGB = "#"; - if (rgb.length !== 3) {this.TEX.Error("RGB colors require 3 numbers")} + if (rgb.length !== 3) { + this.TEX.Error(MathJax.Localization._(["TeX", "RGBArg1"], + "RGB colors require 3 numbers")) + } for (var i = 0; i < 3; i++) { - if (!rgb[i].match(/^\d+$/)) {this.TEX.Error("Invalid number")} + if (!rgb[i].match(/^\d+$/)) { + this.TEX.Error(MathJax.Localization._(["TeX", "InvalidNumber"], + "Invalid number")) + } var n = parseInt(rgb[i]); - if (n > 255) {this.TEX.Error("RGB values must be between 0 and 255")} + if (n > 255) { + this.TEX.Error( + MathJax.Localization._(["TeX", "RGBArg2"], + "RGB values must be between 0 and 255") + ) + } n = n.toString(16); if (n.length < 2) {n = "0"+n} RGB += n; } @@ -154,9 +183,18 @@ MathJax.Extension["TeX/color"] = { * Get a gray-scale value */ get_gray: function (gray) { - if (!gray.match(/^(\d+(\.\d*)?|\.\d+)$/)) {this.TEX.Error("Invalid decimal number")} + if (!gray.match(/^(\d+(\.\d*)?|\.\d+)$/)) { + this.TEX.Error( + MathJax.Localization._(["TeX", "InvalidDecimalNumber"], + "Invalid decimal number") + ) + } var n = parseFloat(gray); - if (n < 0 || n > 1) {this.TEX.Error("Grey-scale values must be between 0 and 1")} + if (n < 0 || n > 1) { + this.TEX.Error( + MathJax.Localization._(["TeX", "GrayScalerArg"], + "Grey-scale values must be between 0 and 1")) + } n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n} return "#"+n+n+n; }, diff --git a/unpacked/extensions/TeX/extpfeil.js b/unpacked/extensions/TeX/extpfeil.js index b0a5d2fcb..717ca75ac 100644 --- a/unpacked/extensions/TeX/extpfeil.js +++ b/unpacked/extensions/TeX/extpfeil.js @@ -72,12 +72,25 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { var cs = this.GetArgument(name), space = this.GetArgument(name), chr = this.GetArgument(name); - if (!cs.match(/^\\([a-z]+|.)$/i)) - {TEX.Error("First argument to "+name+" must be a control sequence name")} - if (!space.match(/^(\d+),(\d+)$/)) - {TEX.Error("Second argument to "+name+" must be two integers separated by a comma")} - if (!chr.match(/^(\d+|0x[0-9A-F]+)$/i)) - {TEX.Error("Third argument to "+name+" must be a unicode character number")} + if (!cs.match(/^\\([a-z]+|.)$/i)) { + TEX.Error( + MathJax.Localization._(["TeX", "NewextarrowArg1"] + "First argument to %1 must be a control sequence name", name) + ) + } + if (!space.match(/^(\d+),(\d+)$/)) { + TEX.Error( + MathJax.Localization._(["TeX", "NewextarrowArg2"] + "Second argument to %1 must be two integers separated by a comma", + name) + ) + } + if (!chr.match(/^(\d+|0x[0-9A-F]+)$/i)) { + TEX.Error( + MathJax.Localization._(["TeX", "NewextarrowArg3"] + "Third argument to %1 must be a unicode character number", name) + ) + } cs = cs.substr(1); space = space.split(","); chr = parseInt(chr); TEXDEF.macros[cs] = ['xArrow',chr,parseInt(space[0]),parseInt(space[1])]; } diff --git a/unpacked/extensions/TeX/mhchem.js b/unpacked/extensions/TeX/mhchem.js index 4dcaf9cd0..02007806e 100644 --- a/unpacked/extensions/TeX/mhchem.js +++ b/unpacked/extensions/TeX/mhchem.js @@ -352,11 +352,22 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (C === "{") {braces++} else if (C === "}") { if (braces) {braces--} - else {TEX.Error("Extra close brace or missing open brace")} + else { + TEX.Error( + MathJax.Localization._( + ["TeX", "ExtraCloseMissingOpen"], + "Extra close brace or missing open brace" + ) + ) + } } } - if (braces) {TEX.Error("Missing close brace")}; - TEX.Error("Can't find closing "+c); + if (braces) { + TEX.Error(MathJax.Localization._(["TeX", "MissingCloseBrace"], + "Missing close brace")) + }; + TEX.Error(MathJax.Localization._(["TeX", "NoClosingChar"], + "Can't find closing %1", c) } }); diff --git a/unpacked/extensions/TeX/newcommand.js b/unpacked/extensions/TeX/newcommand.js index 74aa1a46e..a0eb655be 100644 --- a/unpacked/extensions/TeX/newcommand.js +++ b/unpacked/extensions/TeX/newcommand.js @@ -30,6 +30,11 @@ MathJax.Extension["TeX/newcommand"] = { MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var _ = function (id) { + return MathJax.Localization._.apply(MathJax.Localization, + [ ["TeX", id] ].concat([].slice.call(arguments,1))) + }; + var TEX = MathJax.InputJax.TeX; var TEXDEF = TEX.Definitions; @@ -55,10 +60,16 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { opt = this.GetBrackets(name), def = this.GetArgument(name); if (cs.charAt(0) === "\\") {cs = cs.substr(1)} - if (!cs.match(/^(.|[a-z]+)$/i)) {TEX.Error("Illegal control sequence name for "+name)} + if (!cs.match(/^(.|[a-z]+)$/i)) { + TEX.Error(_("IllegalControlSequenceName", + "Illegal control sequence name for %1", name)) + } if (n) { n = this.trimSpaces(n); - if (!n.match(/^[0-9]+$/)) {TEX.Error("Illegal number of parameters specified in "+name)} + if (!n.match(/^[0-9]+$/)) { + TEX.Error(_("IllegalParamNumber" + "Illegal number of parameters specified in %1", name)) + } } this.setDef(cs,['Macro',def,n,opt]); }, @@ -73,7 +84,10 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { edef = this.GetArgument(name); if (n) { n = this.trimSpaces(n); - if (!n.match(/^[0-9]+$/)) {TEX.Error("Illegal number of parameters specified in "+name)} + if (!n.match(/^[0-9]+$/)) { + TEX.Error(_("IllegalParamNumber" + "Illegal number of parameters specified in %1", name)) + } } this.setEnv(env,['BeginEnv','EndEnv',bdef,edef,n]); }, @@ -130,7 +144,10 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { */ GetCSname: function (cmd) { var c = this.GetNext(); - if (c !== "\\") {TEX.Error("\\ must be followed by a control sequence")} + if (c !== "\\") { + TEX.Error(_("DoubleBackSlash", + "\\ must be followed by a control sequence")) + } var cs = this.trimSpaces(this.GetArgument(cmd)); return cs.substr(1); }, @@ -146,8 +163,15 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (c === '#') { if (i !== this.i) {params[n] = this.string.substr(i,this.i-i)} c = this.string.charAt(++this.i); - if (!c.match(/^[1-9]$/)) {TEX.Error("Illegal use of # in template for "+cs)} - if (parseInt(c) != ++n) {TEX.Error("Parameters for "+cs+" must be numbered sequentially")} + if (!c.match(/^[1-9]$/)) { + TEX.Error(_("CantUseHash2", + "Illegal use of # in template for %1", cs)) + } + if (parseInt(c) != ++n) { + TEX.Error(_( + "SequentialParam", + "Parameters for %1 must be numbered sequentially", cs)) + } i = this.i+1; } else if (c === '{') { if (i !== this.i) {params[n] = this.string.substr(i,this.i-i)} @@ -155,7 +179,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { } this.i++; } - TEX.Error("Missing replacement string for definition of "+cmd); + TEX.Error(_("MissingReplacementString", + "Missing replacement string for definition of %1", cmd)); }, /* @@ -164,15 +189,23 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { MacroWithTemplate: function (name,text,n,params) { if (n) { var args = []; this.GetNext(); - if (params[0] && !this.MatchParam(params[0])) - {TEX.Error("Use of "+name+" doesn't match its definition")} + if (params[0] && !this.MatchParam(params[0])) { + TEX.Error( + _("MismatchUseDef", + "Use of %1 doesn't match its definition", name)) + ) + } for (var i = 0; i < n; i++) {args.push(this.GetParameter(name,params[i+1]))} text = this.SubstituteArgs(args,text); } this.string = this.AddArgs(text,this.string.slice(this.i)); this.i = 0; - if (++this.macroCount > TEX.config.MAXMACROS) - {TEX.Error("MathJax maximum macro substitution count exceeded; is there a recursive macro call?")} + if (++this.macroCount > TEX.config.MAXMACROS) { + TEX.Error( + _("MaxMacroSub1", + "MathJax maximum macro substitution count exceeded; is there a recursive macro call?") + ) + } }, /* @@ -211,7 +244,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { this.i++; j++; hasBraces = 0; } } - TEX.Error("Runaway argument for "+name+"?"); + TEX.Error( + _("RunawayArgument", "Runaway argument for %1?", name) + ); }, /* diff --git a/unpacked/jax/input/TeX/jax.js b/unpacked/jax/input/TeX/jax.js index f1cd6f878..c31c4947f 100644 --- a/unpacked/jax/input/TeX/jax.js +++ b/unpacked/jax/input/TeX/jax.js @@ -1267,7 +1267,7 @@ * Handle hash marks outside of definitions */ Hash: function (c) { - TEX.Error(_("CanUseHash", + TEX.Error(_("CantUseHash1", "You can't use 'macro parameter character #' in math mode")); }, @@ -1323,7 +1323,7 @@ var delim = this.GetDelimiter(name); if (this.stack.Top().type !== "left") { TEX.Error(_("MisplacedMiddle", - "%1 must be within \\left and \\right", name)} + "%1 must be within \\left and \\right", name))} this.Push(MML.mo(delim).With({stretchy:true})); },