From 173c501eaee7d989168808662288349c7382f3a5 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 10 Apr 2013 10:16:14 -0400 Subject: [PATCH] Fixed localization issues pointed out by fred (this creates some new messages that need to be translated). --- unpacked/extensions/TeX/AMSmath.js | 5 +++-- unpacked/extensions/TeX/color.js | 25 +++++++++++++++-------- unpacked/jax/input/TeX/jax.js | 7 ++++--- unpacked/localization/en/TeX.js | 32 ++++++++++++------------------ unpacked/localization/fr/TeX.js | 24 +++++++++------------- 5 files changed, 46 insertions(+), 47 deletions(-) diff --git a/unpacked/extensions/TeX/AMSmath.js b/unpacked/extensions/TeX/AMSmath.js index 819716d50..ae737657b 100644 --- a/unpacked/extensions/TeX/AMSmath.js +++ b/unpacked/extensions/TeX/AMSmath.js @@ -186,7 +186,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (global.label) {TEX.Error(["MultipleCommand","Multiple %1",name])} global.label = label; if (AMS.labels[label] || AMS.eqlabels[label]) - {TEX.Error(["MultipleLabel","Label '%1' mutiply defined",label])} + {TEX.Error(["MultipleLabel","Label '%1' multiply defined",label])} AMS.eqlabels[label] = "???"; // will be replaced by tag value later } }, @@ -461,7 +461,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { EndRow: function () { if (this.row.length != 1) { TEX.Error(["MultlineRowsOneCol", - "multline rows must have exactly one column"]); + "The rows within the %1 environment must have exactly one column", + "multline"]); } this.table.push(this.row); this.row = []; }, diff --git a/unpacked/extensions/TeX/color.js b/unpacked/extensions/TeX/color.js index 7b5bab00c..bab21f2b2 100644 --- a/unpacked/extensions/TeX/color.js +++ b/unpacked/extensions/TeX/color.js @@ -125,13 +125,16 @@ MathJax.Extension["TeX/color"] = { get_rgb: function (rgb) { rgb = rgb.split(/,/); var RGB = "#"; if (rgb.length !== 3) - {this.TEX.Error(["rgbArg1","rgb colors require 3 decimal numbers"])} + {this.TEX.Error(["ModelArg1","Color values for the %1 model require 3 numbers","rgb"])} for (var i = 0; i < 3; i++) { if (!rgb[i].match(/^(\d+(\.\d*)?|\.\d+)$/)) {this.TEX.Error(["InvalidDecimalNumber","Invalid decimal number"])} var n = parseFloat(rgb[i]); - if (n < 0 || n > 1) - {this.TEX.Error(["rgbArg2","rgb values must be between 0 and 1"])} + if (n < 0 || n > 1) { + this.TEX.Error(["ModelArg2", + "Color values for the %1 model must be between %2 and %3", + "rgb",0,1]); + } n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n} RGB += n; } @@ -144,13 +147,16 @@ MathJax.Extension["TeX/color"] = { get_RGB: function (rgb) { rgb = rgb.split(/,/); var RGB = "#"; if (rgb.length !== 3) - {this.TEX.Error(["RGBArg1","RGB colors require 3 numbers"])} + {this.TEX.Error(["ModelArg1","Color values for the %1 model require 3 numbers","RGB"])} for (var i = 0; i < 3; i++) { if (!rgb[i].match(/^\d+$/)) {this.TEX.Error(["InvalidNumber","Invalid number"])} var n = parseInt(rgb[i]); - if (n > 255) - {this.TEX.Error(["RGBArg2","RGB values must be between 0 and 255"])} + if (n > 255) { + this.TEX.Error(["ModelArg2", + "Color values for the %1 model must be between %2 and %3", + "RGB",0,255]); + } n = n.toString(16); if (n.length < 2) {n = "0"+n} RGB += n; } @@ -164,8 +170,11 @@ MathJax.Extension["TeX/color"] = { if (!gray.match(/^(\d+(\.\d*)?|\.\d+)$/)) {this.TEX.Error(["InvalidDecimalNumber","Invalid decimal number"])} var n = parseFloat(gray); - if (n < 0 || n > 1) - {this.TEX.Error(["GrayScalerArg","Grey-scale values must be between 0 and 1"])} + if (n < 0 || n > 1) { + this.TEX.Error(["ModelArg2", + "Color values for the %1 model must be between %2 and %3", + "gray",0,1]); + } n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n} return "#"+n+n+n; }, diff --git a/unpacked/jax/input/TeX/jax.js b/unpacked/jax/input/TeX/jax.js index b942c5336..af8aa55f5 100644 --- a/unpacked/jax/input/TeX/jax.js +++ b/unpacked/jax/input/TeX/jax.js @@ -156,8 +156,9 @@ STACKITEM.subsup = STACKITEM.Subclass({ type: "subsup", stopError: /*_()*/ ["MissingScript","Missing superscript or subscript argument"], + supError: /*_()*/ ["MissingOpenForSup","Missing open brace for superscript"], + subError: /*_()*/ ["MissingOpenForSup","Missing open brace for subscript"], checkItem: function (item) { - var script = ["","subscript","superscript"][this.position]; if (item.type === "open" || item.type === "left") {return true} if (item.type === "mml") { if (this.primes) { @@ -168,7 +169,7 @@ return STACKITEM.mml(this.data[0]); } if (this.SUPER(arguments).checkItem.call(this,item)) - {TEX.Error(["MissingOpenForScript","Missing open brace for %1",script])} + {TEX.Error(this[["","subError","supError"][this.position]])} }, Pop: function () {} }); @@ -240,7 +241,7 @@ STACKITEM.position = STACKITEM.Subclass({ type: "position", checkItem: function (item) { - if (item.isClose) {TEX.Error(["MissingBoxFor","Missing box for %1"])} + if (item.isClose) {TEX.Error(["MissingBoxFor","Missing box for %1",name])} if (item.isNotStack) { var mml = item.mmlData(); switch (this.move) { diff --git a/unpacked/localization/en/TeX.js b/unpacked/localization/en/TeX.js index 785fadcc8..1aaf53b77 100644 --- a/unpacked/localization/en/TeX.js +++ b/unpacked/localization/en/TeX.js @@ -20,8 +20,11 @@ MathJax.Localization.addTranslation("en","TeX",{ Misplaced: "Misplaced %1", - MissingOpenForScript: - "Missing open brace for %1", + MissingOpenForSub: + "Missing open brace for subscript", + + MissingOpenForSup: + "Missing open brace for superscript", AmbiguousUseOf: "Ambiguous use of %1", @@ -133,7 +136,7 @@ MathJax.Localization.addTranslation("en","TeX",{ "%1 not allowed in %2 environment", MultipleLabel: - "Label '%1' mutiply defined", + "Label '%1' multiply defined", CommandAtTheBeginingOfLine: "%1 must come at the beginning of the line", @@ -151,7 +154,7 @@ MathJax.Localization.addTranslation("en","TeX",{ "Erroneous nesting of equation structures", MultlineRowsOneCol: - "multline rows must have exactly one column", + "The rows within the %1 environment must have exactly one column", /* bbox */ @@ -171,30 +174,21 @@ MathJax.Localization.addTranslation("en","TeX",{ /* color */ - UndefinedColorModel: + UndefinedColorModel: "Color model '%1' not defined", - rgbArg1: - "rgb colors require 3 decimal numbers", + ModelArg1: + "Color values for the %1 model require 3 numbers", InvalidDecimalNumber: "Invalid decimal number", - rgbArg2: - "rgb values must be between 0 and 1", - - RGBArg1: - "RGB colors require 3 numbers", + ModelArg2: + "Color values for the %1 model must be between %2 and %3", InvalidNumber: "Invalid number", - RGBArg2: - "RGB values must be between 0 and 255", - - GrayScalerArg: - "Grey-scale values must be between 0 and 1", - /* extpfeil */ NewextarrowArg1: @@ -235,7 +229,7 @@ MathJax.Localization.addTranslation("en","TeX",{ "Use of %1 doesn't match its definition", RunawayArgument: - "Argument manquant pour la commande %1?" + "Runaway argument for %1?" /* verb */ diff --git a/unpacked/localization/fr/TeX.js b/unpacked/localization/fr/TeX.js index 03ebb656b..fbfacab7a 100644 --- a/unpacked/localization/fr/TeX.js +++ b/unpacked/localization/fr/TeX.js @@ -20,8 +20,11 @@ MathJax.Localization.addTranslation("fr","TeX",{ Misplaced: "Mauvaise position pour la commande %1", - MissingOpenForScript: - "Accolade ouvrante manquante pour le script %1", + MissingOpenForSub: + "Missing open brace for subscript", // *NEW* + + MissingOpenForSup: + "Missing open brace for superscript", // *NEW* AmbiguousUseOf: "Usage ambigu de la commande %1", @@ -205,27 +208,18 @@ MathJax.Localization.addTranslation("fr","TeX",{ UndefinedColorModel: "Le modèle de couleur '%1' n'est pas défini", - rgbArg1: - "Les couleurs rgb nécéssitent 3 nombres décimaux", + ModelArg1: + "Color values for the %1 model require 3 numbers", // *NEW* 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", + ModelArg2: + "Color values for the %1 model must be between %2 and %3", // *NEW* 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",