Handle HTML snippets better, and fix up messages in FontWarnings and v1.0-warning extensions. Fix French menu items and a few others (thanks Fred). Fix scale-all-math dialog.
This commit is contained in:
parent
660f38959a
commit
535c033e24
|
@ -1,5 +1,6 @@
|
||||||
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
|
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
|
||||||
/* vim: set ts=2 et sw=2 tw=80: */
|
/* vim: set ts=2 et sw=2 tw=80: */
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
*
|
*
|
||||||
* MathJax.js
|
* MathJax.js
|
||||||
|
@ -1056,205 +1057,127 @@ MathJax.Localization = {
|
||||||
|
|
||||||
locale: "fr",
|
locale: "fr",
|
||||||
directory: "[MathJax]/localization",
|
directory: "[MathJax]/localization",
|
||||||
strings: {fr: {}},
|
strings: {
|
||||||
|
en: {isLoaded: true}, // nothing needs to be loaded for this
|
||||||
|
fr: {}
|
||||||
|
},
|
||||||
|
|
||||||
_: function (messageId, phrase) {
|
//
|
||||||
|
// The pattern for substitution escapes:
|
||||||
|
// %n or %{n} or %{plural:%n|option1|option1|...} or %c
|
||||||
|
//
|
||||||
|
pattern: /%(\d+|\{\d+\}|\{[a-z]+:\%\d+(?:\|(?:%(?:\d+|\{\d+\}|.)|[^\}])*)+\}|.)/g,
|
||||||
|
|
||||||
// These variables are used in string parsing
|
_: function (id,phrase) {
|
||||||
var locale = this;
|
if (phrase instanceof Array) {return this.processSnippet(id,phrase)}
|
||||||
var args = arguments;
|
return this.processString(this.lookupPhrase(id,phrase),[].slice.call(arguments,2));
|
||||||
var i, s, m, resultString, resultArray;
|
},
|
||||||
|
|
||||||
function parseNextUnicodePoint(appendToResult)
|
processString: function (string,args,domain) {
|
||||||
{
|
//
|
||||||
var n = s.charCodeAt(i);
|
// Process arguments for substitution
|
||||||
if (n <= 0xD7FF || 0xE000 <= n) {
|
// If the argument is a snippet (and we are processing snippets) do so,
|
||||||
// Code points U+0000 to U+D7FF and U+E000 to U+FFFF.
|
// Otherwise, if it is a number, convert it for the lacale
|
||||||
// Append the character.
|
//
|
||||||
if (appendToResult) resultString += s[i]
|
for (var i = 0, m = args.length; i < m; i++) {
|
||||||
i++;
|
if (domain && args[i] instanceof Array) {args[i] = this.processSnippet(domain,args[i])}
|
||||||
return;
|
|
||||||
} else if (i+1 < m) {
|
|
||||||
// Code points U+10000 to U+10FFFF
|
|
||||||
// Append the surrogate pairs.
|
|
||||||
if (appendToResult) { resultString += s[i]; resultString += s[i+1]; }
|
|
||||||
i+=2
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
// Ignore lead surrogate at the end of the string.
|
//
|
||||||
// This should not happen with valid unicode string.
|
// Split string at escapes and process them individually
|
||||||
i++;
|
//
|
||||||
}
|
var parts = string.split(this.pattern);
|
||||||
|
for (var i = 1, m = parts.length; i < m; i += 2) {
|
||||||
function parseArgument(appendToResult)
|
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
|
||||||
if (!(/\d/.test(s[0]))) return false;
|
parts[i] = args[parts[i]-1] || "???";
|
||||||
|
if (typeof parts[i] === "number") parts[i] = this.number(parts[i]);
|
||||||
// %INTEGER argument substitution
|
} else if (c === "{") { // %{n} or %{plural:%n|...}
|
||||||
var argIndex = s.match(/^\d+/)[0];
|
c = parts[i].substr(1);
|
||||||
i += argIndex.length;
|
if (c >= "0" && c <= "9") { // %{n}
|
||||||
var key = +argIndex+1;
|
parts[i] = args[parts[i].substr(1,parts[i].length-2)-1] || "???";
|
||||||
if (key in args) {
|
if (typeof parts[i] === "number") parts[i] = this.number(parts[i]);
|
||||||
if (appendToResult) {
|
} else { // %{plural:%n|...}
|
||||||
var e = args[key];
|
var match = parts[i].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/);
|
||||||
if (e instanceof Array) {
|
if (match[1] === "plural") {
|
||||||
// if that's an array, concatenate it to the result array
|
var n = args[match[2]-1];
|
||||||
resultArray.push(resultString);
|
if (typeof n === "undefined") {
|
||||||
resultArray = resultArray.concat(e);
|
parts[i] = "???"; // argument doesn't exist
|
||||||
resultString = "";
|
|
||||||
} else if (typeof e === "number") {
|
|
||||||
// if that's a number, append a localized version.
|
|
||||||
resultString += locale.number(e.toString())
|
|
||||||
} else {
|
} else {
|
||||||
// otherwise, just concatenate it to the result string
|
n = this.plural(n) - 1; // index of the form to use
|
||||||
resultString += e;
|
var plurals = match[3].replace(/%\|/g,"%\uEFEF").split(/\|/); // the parts (replacing %| with a special character)
|
||||||
|
if (n >= 0 && n < plurals.length) {
|
||||||
|
parts[i] = this.processString(plurals[n].replace(/\uEFEF/g,"|"),args,domain);
|
||||||
|
} else {
|
||||||
|
parts[i] = "???"; // no string for this index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
} else {parts[i] = "%"+parts[i]} // not "plural:put back the % and leave unchanged
|
||||||
}
|
|
||||||
|
|
||||||
// invalid index: just %INTEGER and continue
|
|
||||||
if (appendToResult) { resultString += "%" + argIndex; }
|
|
||||||
i++;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseInteger(appendToResult)
|
|
||||||
{
|
|
||||||
var number = s.match(/^\{(\d+)\}/);
|
|
||||||
if (!number) return false;
|
|
||||||
|
|
||||||
// %{INTEGER} escaped integer
|
|
||||||
if (appendToResult) { resultString += number[1]; }
|
|
||||||
i += number[0].length;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseChoiceBlock(blockName, choiceFunction)
|
|
||||||
{
|
|
||||||
var pattern = "^\\{"+blockName+":%(\\d)+\\|";
|
|
||||||
var blockStart = s.match(pattern);
|
|
||||||
if (!blockStart) return false;
|
|
||||||
|
|
||||||
var key = +blockStart[1]+1;
|
|
||||||
if (!(key in args)) return false;
|
|
||||||
|
|
||||||
// %\{blockName:%INTEGER|form1|form2 ... \}
|
|
||||||
i = blockStart[0].length;
|
|
||||||
|
|
||||||
var choiceIndex = choiceFunction(args[key]), j = 1;
|
|
||||||
var isChosenBlock = (j === choiceIndex);
|
|
||||||
var blockFound = isChosenBlock;
|
|
||||||
|
|
||||||
while (i < m) {
|
|
||||||
if (s[i] == "|") {
|
|
||||||
// new choice block
|
|
||||||
i++; j++;
|
|
||||||
isChosenBlock = (j === choiceIndex);
|
|
||||||
if (isChosenBlock) blockFound = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (s[i] == "}") {
|
|
||||||
// closing brace
|
|
||||||
i++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (s[i] != "%" || i+1 == m) {
|
|
||||||
// normal char or % at the end of the string
|
|
||||||
parseNextUnicodePoint(isChosenBlock);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// keep only the substring after the %
|
|
||||||
i++; s = s.substr(i); m -= i; i = 0;
|
|
||||||
|
|
||||||
// %INTEGER argument substitution
|
|
||||||
if (parseArgument(isChosenBlock)) continue;
|
|
||||||
|
|
||||||
// %{INTEGER} escaped integer
|
|
||||||
if (parseInteger(isChosenBlock)) continue;
|
|
||||||
|
|
||||||
// %CHAR: escaped character
|
|
||||||
parseNextUnicodePoint(isChosenBlock);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!blockFound) {
|
|
||||||
i = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function transformString(string)
|
|
||||||
{
|
|
||||||
s = string;
|
|
||||||
i = 0;
|
|
||||||
m = s.length;
|
|
||||||
resultString = "";
|
|
||||||
resultArray = [];
|
|
||||||
|
|
||||||
while (i < m) {
|
|
||||||
if (s[i] != "%" || i+1 == m) {
|
|
||||||
// normal char or % at the end of the string
|
|
||||||
parseNextUnicodePoint(true);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// keep only the substring after the %
|
|
||||||
i++; s = s.substr(i); m -= i; i = 0;
|
|
||||||
|
|
||||||
// %INTEGER argument substitution
|
|
||||||
if (parseArgument(true)) continue;
|
|
||||||
|
|
||||||
// %{INTEGER} escaped integer
|
|
||||||
if (parseInteger(true)) continue;
|
|
||||||
|
|
||||||
// %\{plural:%INTEGER|form1|form2 ... \} plural forms
|
|
||||||
if (parseChoiceBlock("plural", locale.plural)) continue;
|
|
||||||
|
|
||||||
// %CHAR: escaped character
|
|
||||||
parseNextUnicodePoint(true);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resultArray.length == 0) return resultString;
|
|
||||||
|
|
||||||
return resultArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
function transformHTMLSnippet(snippet)
|
|
||||||
{
|
|
||||||
for (var key in snippet) {
|
|
||||||
var e = snippet[key];
|
|
||||||
if (typeof e === "string") {
|
|
||||||
// transform the string content
|
|
||||||
snippet[key] = transformString(e);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (e[1]) {
|
|
||||||
// transform attribute values
|
|
||||||
for (var key2 in e[1]) {
|
|
||||||
snippet[key][1][key2] = transformString(e[1][key2]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e[2]) {
|
}
|
||||||
// transform the HTML content
|
//
|
||||||
snippet[key][2] = transformHTMLSnippet(e[2]);
|
// If we are not forming a snippet, return the completed string
|
||||||
|
//
|
||||||
|
if (!domain) {return parts.join("")}
|
||||||
|
//
|
||||||
|
// We need to return an HTML snippet, so buld it from the
|
||||||
|
// broken up string with inserted parts (that could be snippets)
|
||||||
|
//
|
||||||
|
var snippet = [], part = "";
|
||||||
|
for (i = 0; i < m; i++) {
|
||||||
|
part += parts[i]; i++; // add the string and move on to substitution result
|
||||||
|
if (i < m) {
|
||||||
|
if (parts[i] instanceof Array) { // substitution was a snippet
|
||||||
|
snippet.push(part); // add the accumulated string
|
||||||
|
snippet = snippet.concat(parts[i]); // concatenate the substution snippet
|
||||||
|
part = ""; // start accumulating a new string
|
||||||
|
} else { // substitution was a string
|
||||||
|
part += parts[i]; // add to accumulating string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (part !== "") {snippet.push(part)} // add final string
|
||||||
return snippet;
|
return snippet;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
processSnippet: function (domain,snippet) {
|
||||||
|
var result = []; // the new snippet
|
||||||
|
//
|
||||||
|
// Look through the original snippet for
|
||||||
|
// strings or snippets to translate
|
||||||
|
//
|
||||||
|
for (var i = 0, m = snippet.length; i < m; i++) {
|
||||||
|
if (snippet[i] instanceof Array) {
|
||||||
|
//
|
||||||
|
// This could be a sub-snippet:
|
||||||
|
// ["tag"] or ["tag",{properties}] or ["tag",{properties},snippet]
|
||||||
|
// Or it could be something to translate:
|
||||||
|
// [id,string,args] or [domain,snippet]
|
||||||
|
var data = snippet[i];
|
||||||
|
if (typeof data[1] === "string") { // [id,string,args]
|
||||||
|
var id = data[0]; if (!(id instanceof Array)) {id = [domain,id]}
|
||||||
|
var phrase = this.lookupPhrase(id,data[1]);
|
||||||
|
result = result.concat(this.processString(phrase,data.slice(2),domain));
|
||||||
|
} else if (data[1] instanceof Array) { // [domain,snippet]
|
||||||
|
result = result.concat(this.processSnippet.apply(this,data));
|
||||||
|
} else if (data.length >= 3) { // ["tag",{properties},snippet]
|
||||||
|
result.push([data[0],data[1],this.processSnippet(domain,data[2])]);
|
||||||
|
} else { // ["tag"] or ["tag",{properties}]
|
||||||
|
result.push(snippet[i]);
|
||||||
|
}
|
||||||
|
} else { // a string
|
||||||
|
result.push(snippet[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
|
lookupPhrase: function (id,phrase,domain) {
|
||||||
//
|
//
|
||||||
// Get the domain and messageID
|
// Get the domain and messageID
|
||||||
//
|
//
|
||||||
var domain = "_";
|
if (!domain) {domain = "_"}
|
||||||
if (messageId instanceof Array) {
|
if (id instanceof Array) {domain = (id[0] || "_"); id = (id[1] || "")}
|
||||||
domain = (messageId[0] || "_");
|
|
||||||
messageId = (messageId[1] || "");
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// Check if the data is available and if not,
|
// Check if the data is available and if not,
|
||||||
// load it and throw a restart error so the calling
|
// load it and throw a restart error so the calling
|
||||||
|
@ -1270,18 +1193,14 @@ MathJax.Localization = {
|
||||||
if (localeData) {
|
if (localeData) {
|
||||||
if (localeData.domains && domain in localeData.domains) {
|
if (localeData.domains && domain in localeData.domains) {
|
||||||
var domainData = localeData.domains[domain];
|
var domainData = localeData.domains[domain];
|
||||||
if (domainData.strings && messageId in domainData.strings)
|
if (domainData.strings && id in domainData.strings)
|
||||||
{phrase = domainData.strings[messageId]}
|
{phrase = domainData.strings[id]}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
if (typeof phrase === "string") {
|
// return the translated phrase
|
||||||
// handle the phrase as a simple string
|
//
|
||||||
return transformString(phrase);
|
return phrase;
|
||||||
}
|
|
||||||
|
|
||||||
// handle the phrase as a HTML snippet
|
|
||||||
return transformHTMLSnippet(phrase);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2004,7 +1923,6 @@ MathJax.Hub = {
|
||||||
// Put up final message, reset the state and return
|
// Put up final message, reset the state and return
|
||||||
//
|
//
|
||||||
if (state.scripts.length && this.config.showProcessingMessages)
|
if (state.scripts.length && this.config.showProcessingMessages)
|
||||||
// Localization: see filterText
|
|
||||||
{MathJax.Message.Set(["ProcessMath","Processing math: %1%%",100],0)}
|
{MathJax.Message.Set(["ProcessMath","Processing math: %1%%",100],0)}
|
||||||
state.start = new Date().getTime(); state.i = state.j = 0;
|
state.start = new Date().getTime(); state.i = state.j = 0;
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -88,11 +88,8 @@
|
||||||
(function (HUB,HTML) {
|
(function (HUB,HTML) {
|
||||||
var VERSION = "2.1.1";
|
var VERSION = "2.1.1";
|
||||||
|
|
||||||
var _ = function (id) {
|
var STIXURL = "http://www.stixfonts.org/";
|
||||||
return MathJax.Localization._.apply(MathJax.Localization,
|
var MATHJAXURL = "http://www.mathjax.org/help-v2/fonts";
|
||||||
[["FontWarnings",id]].concat([].slice.call(arguments,1))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
var CONFIG = HUB.CombineConfig("FontWarnings",{
|
var CONFIG = HUB.CombineConfig("FontWarnings",{
|
||||||
//
|
//
|
||||||
|
@ -119,37 +116,35 @@
|
||||||
// The messages for the various situations
|
// The messages for the various situations
|
||||||
//
|
//
|
||||||
Message: {
|
Message: {
|
||||||
// Localization:
|
|
||||||
// how do we ensure it is updated when the language is changed?
|
|
||||||
webFont: [
|
webFont: [
|
||||||
["closeBox"],
|
["closeBox"],
|
||||||
_("webFont",
|
["webFont",
|
||||||
"MathJax is using web-based fonts to display the mathematics "+
|
"MathJax is using web-based fonts to display the mathematics "+
|
||||||
"on this page. These take time to download, so the page would "+
|
"on this page. These take time to download, so the page would "+
|
||||||
"render faster if you installed math fonts directly in your "+
|
"render faster if you installed math fonts directly in your "+
|
||||||
"system's font folder."),
|
"system's font folder."],
|
||||||
["fonts"]
|
["fonts"]
|
||||||
],
|
],
|
||||||
|
|
||||||
imageFonts: [
|
imageFonts: [
|
||||||
["closeBox"],
|
["closeBox"],
|
||||||
_("imageFonts",
|
["imageFonts",
|
||||||
"MathJax is using its image fonts rather than local or web-based fonts. "+
|
"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 "+
|
"This will render slower than usual, and the mathematics may not print "+
|
||||||
"at the full resolution of your printer."),
|
"at the full resolution of your printer."],
|
||||||
|
|
||||||
["fonts"],
|
["fonts"],
|
||||||
["webfonts"]
|
["webfonts"]
|
||||||
],
|
],
|
||||||
|
|
||||||
noFonts: [
|
noFonts: [
|
||||||
["closeBox"],
|
["closeBox"],
|
||||||
_("noFonts",
|
["noFonts",
|
||||||
"MathJax is unable to locate a font to use to display "+
|
"MathJax is unable to locate a font to use to display "+
|
||||||
"its mathematics, and image fonts are not available, so it "+
|
"its mathematics, and image fonts are not available, so it "+
|
||||||
"is falling back on generic unicode characters in hopes that "+
|
"is falling back on generic unicode characters in hopes that "+
|
||||||
"your browser will be able to display them. Some characters "+
|
"your browser will be able to display them. Some characters "+
|
||||||
"may not show up properly, or possibly not at all."),
|
"may not show up properly, or possibly not at all."],
|
||||||
["fonts"],
|
["fonts"],
|
||||||
["webfonts"]
|
["webfonts"]
|
||||||
]
|
]
|
||||||
|
@ -183,40 +178,48 @@
|
||||||
[["span",{style:{position:"relative", bottom:".2em"}},["x"]]]
|
[["span",{style:{position:"relative", bottom:".2em"}},["x"]]]
|
||||||
]],
|
]],
|
||||||
|
|
||||||
// Localization:
|
webfonts: [
|
||||||
// - decide HTML snippet format
|
|
||||||
// how do we ensure it is updated when the language is changed?
|
|
||||||
webFonts: [
|
|
||||||
["p"],
|
["p"],
|
||||||
_("webFonts",
|
["webfonts",
|
||||||
"Most modern browsers allow for fonts to be downloaded over the web. "+
|
"Most modern browsers allow for fonts to be downloaded over the web. "+
|
||||||
"Updating to a more recent version of your browser (or changing "+
|
"Updating to a more recent version of your browser (or changing "+
|
||||||
"browsers) could improve the quality of the mathematics on this page.")
|
"browsers) could improve the quality of the mathematics on this page."
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
fonts: _("fonts",
|
fonts: [
|
||||||
"%1 MathJax can use either the %2 or the %3 "+
|
["p"],
|
||||||
". Download and install either one to improve your MathJax experience.",
|
["fonts",
|
||||||
[["p"]],
|
"MathJax can use either the %1 or the %2",
|
||||||
[["a",{href:"http://www.stixfonts.org/",target:"_blank"},
|
[["a",{href:STIXURL,target:"_blank"},[["STIXfonts","STIX fonts"]]]],
|
||||||
_("STIXfonts", "STIX fonts")]],
|
[["a",{href:MATHJAXURL,target:"_blank"},[["TeXfonts","MathJax TeX fonts"]]]]
|
||||||
[["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"},
|
]
|
||||||
[_("TeXfonts", "MathJax TeX fonts")]]]
|
],
|
||||||
),
|
|
||||||
|
|
||||||
STIXfonts: _("PageDesigned",
|
// fonts: [
|
||||||
"%1 This page is designed to use the %2."+
|
// ["p"],
|
||||||
" Download and install those fonts to improve your MathJax experience.",
|
// ["fonts",
|
||||||
[["p"]],
|
// "MathJax can use either the [STIX fonts](%1) or the [MathJax TeX fonts](%2)",
|
||||||
[["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"},
|
// "http://www.stixfonts.org/","http://www.mathjax.org/help-v2/fonts/"]
|
||||||
[_("STIXfonts", "STIX fonts")]]]),
|
// ],
|
||||||
|
|
||||||
TeXfonts: _("PageDesigned",
|
STIXfonts: [
|
||||||
"%1 This page is designed to use the %2."+
|
["p"],
|
||||||
|
["PageDesigned",
|
||||||
|
"This page is designed to use the %1. " +
|
||||||
"Download and install those fonts to improve your MathJax experience.",
|
"Download and install those fonts to improve your MathJax experience.",
|
||||||
[["p"]],
|
[["a",{href:STIXURL,target:"_blank"},[["STIXfonts","STIX fonts"]]]]
|
||||||
[["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"},
|
]
|
||||||
[_("TeXfonts", "MathJax TeX fonts")]]])
|
],
|
||||||
|
|
||||||
|
TeXfonts: [
|
||||||
|
["p"],
|
||||||
|
["PageDesigned",
|
||||||
|
"This page is designed to use the %1. " +
|
||||||
|
"Download and install those fonts to improve your MathJax experience.",
|
||||||
|
[["a",{href:MATHJAXURL,target:"_blank"},[["TeXfonts","MathJax TeX fonts"]]]]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -251,10 +254,17 @@
|
||||||
} else {delete CONFIG.messageStyle.filter}
|
} else {delete CONFIG.messageStyle.filter}
|
||||||
CONFIG.messageStyle.maxWidth = (document.body.clientWidth-75) + "px";
|
CONFIG.messageStyle.maxWidth = (document.body.clientWidth-75) + "px";
|
||||||
var i = 0; while (i < data.length) {
|
var i = 0; while (i < data.length) {
|
||||||
if (data[i] instanceof Array && CONFIG.HTML[data[i][0]])
|
if (data[i] instanceof Array) {
|
||||||
{data.splice.apply(data,[i,1].concat(CONFIG.HTML[data[i][0]]))} else {i++}
|
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") {
|
||||||
|
data.splice.apply(data,[i,1].concat(message));
|
||||||
|
i += message.length;
|
||||||
|
} else {i++}
|
||||||
|
} else {i++}
|
||||||
}
|
}
|
||||||
DATA.div = HTMLCSS.addElement(frame,"div",{id:"MathJax_FontWarning",style:CONFIG.messageStyle},data);
|
DATA.div = HTMLCSS.addElement(frame,"div",
|
||||||
|
{id:"MathJax_FontWarning",style:CONFIG.messageStyle},data);
|
||||||
if (CONFIG.removeAfter) {
|
if (CONFIG.removeAfter) {
|
||||||
HUB.Register.StartupHook("End",function ()
|
HUB.Register.StartupHook("End",function ()
|
||||||
{DATA.timer = setTimeout(FADEOUT,CONFIG.removeAfter)});
|
{DATA.timer = setTimeout(FADEOUT,CONFIG.removeAfter)});
|
||||||
|
@ -296,7 +306,13 @@
|
||||||
if (message.match(/- Web-Font/)) {if (localFonts) {MSG = "webFont"}}
|
if (message.match(/- Web-Font/)) {if (localFonts) {MSG = "webFont"}}
|
||||||
else if (message.match(/- using image fonts/)) {MSG = "imageFonts"}
|
else if (message.match(/- using image fonts/)) {MSG = "imageFonts"}
|
||||||
else if (message.match(/- no valid font/)) {MSG = "noFonts"}
|
else if (message.match(/- no valid font/)) {MSG = "noFonts"}
|
||||||
if (MSG && CONFIG.Message[MSG]) {CREATEMESSAGE(CONFIG.Message[MSG])}
|
if (MSG && CONFIG.Message[MSG]) {
|
||||||
|
MathJax.Callback.Queue(
|
||||||
|
["loadDomain",MathJax.Localization,"FontWarnings"], // load locale
|
||||||
|
["loadDomain",MathJax.Localization,"FontWarnings"], // load domain
|
||||||
|
[CREATEMESSAGE,CONFIG.Message[MSG]]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -772,7 +772,7 @@
|
||||||
MENU.Scale = function () {
|
MENU.Scale = function () {
|
||||||
var HTMLCSS = OUTPUT["HTML-CSS"], nMML = OUTPUT.NativeMML, SVG = OUTPUT.SVG;
|
var HTMLCSS = OUTPUT["HTML-CSS"], nMML = OUTPUT.NativeMML, SVG = OUTPUT.SVG;
|
||||||
var SCALE = (HTMLCSS||nMML||SVG||{config:{scale:100}}).config.scale;
|
var SCALE = (HTMLCSS||nMML||SVG||{config:{scale:100}}).config.scale;
|
||||||
var scale = prompt(_("ScaleMath", "Scale all mathematics (compared to surrounding text) by %1%%",SCALE));
|
var scale = prompt(_("ScaleMath", "Scale all mathematics (compared to surrounding text) by"),SCALE+"%");
|
||||||
if (scale) {
|
if (scale) {
|
||||||
if (scale.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)) {
|
if (scale.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)) {
|
||||||
scale = parseFloat(scale);
|
scale = parseFloat(scale);
|
||||||
|
@ -898,7 +898,7 @@
|
||||||
MENU.cookie.mpContext = MENU.cookie.mpMouse = CONFIG.settings.mpMouse;
|
MENU.cookie.mpContext = MENU.cookie.mpMouse = CONFIG.settings.mpMouse;
|
||||||
MENU.saveCookie();
|
MENU.saveCookie();
|
||||||
MathJax.Hub.Queue(["Rerender",MathJax.Hub])
|
MathJax.Hub.Queue(["Rerender",MathJax.Hub])
|
||||||
} else if (!discoverable && item.name[0] === "Menu Events" && CONFIG.settings.mpContext) {
|
} else if (!discoverable && item.name[1] === "Menu Events" && CONFIG.settings.mpContext) {
|
||||||
alert(_.apply(_,MESSAGE.IE9warning));
|
alert(_.apply(_,MESSAGE.IE9warning));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,16 +58,11 @@
|
||||||
CONFIG.style.position = "absolute";
|
CONFIG.style.position = "absolute";
|
||||||
} else {delete CONFIG.style.filter}
|
} else {delete CONFIG.style.filter}
|
||||||
CONFIG.style.maxWidth = (document.body.clientWidth-75) + "px";
|
CONFIG.style.maxWidth = (document.body.clientWidth-75) + "px";
|
||||||
|
MathJax.Localization.Try(function () {
|
||||||
DIV = HTML.addElement(frame,"div",{id:"MathJax_ConfigWarning",style:CONFIG.style},
|
DIV = HTML.addElement(frame,"div",{id:"MathJax_ConfigWarning",style:CONFIG.style},
|
||||||
// Localization:
|
MathJax.Localization._("v1.0-warning",
|
||||||
// - decide HTML snippet format
|
[
|
||||||
// - how do we ensure it is updated when the language is changed?
|
[
|
||||||
MathJax.Localization._(["ConfigWarning", "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",{
|
"div",{
|
||||||
style: {
|
style: {
|
||||||
position:"absolute", overflow:"hidden", top:".1em", right:".1em",
|
position:"absolute", overflow:"hidden", top:".1em", right:".1em",
|
||||||
|
@ -83,14 +78,23 @@
|
||||||
onclick: function () {DIV.style.display = "none"}
|
onclick: function () {DIV.style.display = "none"}
|
||||||
},
|
},
|
||||||
[["span",{style:{position:"relative", bottom:".2em"}},["x"]]]
|
[["span",{style:{position:"relative", bottom:".2em"}},["x"]]]
|
||||||
]],
|
],
|
||||||
|
["MissingConfig",
|
||||||
|
"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",
|
||||||
[["code",{},["config/MathJax.js"]]],
|
[["code",{},["config/MathJax.js"]]],
|
||||||
[["p",{style:{"text-align":"center"}},[
|
[["p",{style:{"text-align":"center"}},[
|
||||||
["a",
|
["a",
|
||||||
{href:"http://www.mathjax.org/help/configuration"},
|
{href:"http://www.mathjax.org/help-v2/configuration"},
|
||||||
["http://www.mathjax.org/help/configuration"]
|
["http://www.mathjax.org/help-v2/configuration"]
|
||||||
]
|
]
|
||||||
]]]))
|
]]]
|
||||||
|
]
|
||||||
|
])
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
})(MathJax.Hub,MathJax.HTML);
|
})(MathJax.Hub,MathJax.HTML);
|
||||||
|
|
|
@ -137,7 +137,7 @@
|
||||||
|
|
||||||
loadWebFont: function (font) {
|
loadWebFont: function (font) {
|
||||||
HUB.Startup.signal.Post("HTML-CSS Jax - Web-Font "+HTMLCSS.fontInUse+"/"+font.directory);
|
HUB.Startup.signal.Post("HTML-CSS Jax - Web-Font "+HTMLCSS.fontInUse+"/"+font.directory);
|
||||||
var n = MESSAGE(["LoadWebFont","Loading webfont %1",HTMLCSS.fontInUse+"/"+font.directory]);
|
var n = MESSAGE(["LoadWebFont","Loading web-font %1",HTMLCSS.fontInUse+"/"+font.directory]);
|
||||||
var done = MathJax.Callback({}); // called when font is loaded
|
var done = MathJax.Callback({}); // called when font is loaded
|
||||||
var callback = MathJax.Callback(["loadComplete",this,font,n,done]);
|
var callback = MathJax.Callback(["loadComplete",this,font,n,done]);
|
||||||
AJAX.timer.start(AJAX,[this.checkWebFont,font,callback],0,this.timeout);
|
AJAX.timer.start(AJAX,[this.checkWebFont,font,callback],0,this.timeout);
|
||||||
|
|
|
@ -32,12 +32,12 @@ MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
|
||||||
"être améliorée.",
|
"être améliorée.",
|
||||||
|
|
||||||
fonts:
|
fonts:
|
||||||
"%1 MathJax peut utiliser les %2 ou bien les %3. Téléchargez et"+
|
"MathJax peut utiliser les %1 ou bien les %2. Téléchargez et"+
|
||||||
"installez l'une de ces familles de polices pour améliorer votre"+
|
"installez l'une de ces familles de polices pour améliorer votre"+
|
||||||
"expérience avec MathJax.",
|
"expérience avec MathJax.",
|
||||||
|
|
||||||
PageDesigned:
|
PageDesigned:
|
||||||
"%1 Cette page est conçue pour utiliser les %2. Téléchargez "+
|
"Cette page est conçue pour utiliser les %1. Téléchargez "+
|
||||||
" et installez ces polices pour améliorer votre expérience "+
|
" et installez ces polices pour améliorer votre expérience "+
|
||||||
"avec MathJax",
|
"avec MathJax",
|
||||||
|
|
||||||
|
|
26
unpacked/localization/fr/HTML-CSS.js
Normal file
26
unpacked/localization/fr/HTML-CSS.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
|
||||||
|
"HTML-CSS": {
|
||||||
|
isLoaded: true,
|
||||||
|
strings: {
|
||||||
|
|
||||||
|
LoadWebFont: "Téléchargement la police Web %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"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
MathJax.Ajax.loadComplete("[MathJax]/localization/fr/HTML-CSS.js");
|
|
@ -3,44 +3,44 @@ MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
|
||||||
isLoaded: true,
|
isLoaded: true,
|
||||||
strings: {
|
strings: {
|
||||||
|
|
||||||
Show: "Voir Maths Comme",
|
Show: "Afficher la Formule sous Forme",
|
||||||
MathMLcode: "du Code MathML",
|
MathMLcode: "de Code MathML",
|
||||||
OriginalMathML: "d'Origine MathML",
|
OriginalMathML: "de Code MathML d'Origine",
|
||||||
TeXCommands: "Commandes TeX",
|
TeXCommands: "de Commandes TeX",
|
||||||
AsciiMathInput: "AsciiMathml Entrée",
|
AsciiMathInput: "de code AsciiMathml",
|
||||||
Original: "Forme Originale",
|
Original: "d'Origine",
|
||||||
ErrorMessage: "Message d'Erreur",
|
ErrorMessage: "de Message d'Erreur",
|
||||||
texHints: "Voir les notes TeX dans MathML",
|
texHints: "Afficher les indications TeX dans le code MathML",
|
||||||
Settings: "Paramètres Maths",
|
Settings: "Paramètres des formules",
|
||||||
ZoomTrigger: "Trigger Zoom",
|
ZoomTrigger: "Déclenchement du Zoom par",
|
||||||
Hover: "Flotter",
|
Hover: "Survol de la Souris",
|
||||||
Click: "Clic de Souris",
|
Click: "Clic de Souris",
|
||||||
DoubleClick: "Double-Clic",
|
DoubleClick: "Double-Clic",
|
||||||
NoZoom: "Pas de Zoom",
|
NoZoom: "Pas de Zoom",
|
||||||
TriggerRequires: "Trigger Nécessite",
|
TriggerRequires: "Le déclenchement nécessite l'appui sur la touche",
|
||||||
Option: "Option",
|
Option: "Option",
|
||||||
Alt: "Alt",
|
Alt: "Alt",
|
||||||
Command: "Command",
|
Command: "Command",
|
||||||
Control: "Control",
|
Control: "Control",
|
||||||
Shift: "Shift",
|
Shift: "Shift",
|
||||||
ZoomFactor: "Facteur de Zoom",
|
ZoomFactor: "Facteur de Zoom",
|
||||||
Renderer: "Traduire Maths",
|
Renderer: "Mode de Rendu",
|
||||||
MPHandles: "Laissez MathPlayer Gérer:",
|
MPHandles: "Laissez MathPlayer Gérer les",
|
||||||
MenuEvents: "Sélections du menu",
|
MenuEvents: "Êvénements du menu",
|
||||||
MouseEvents: "Êvénements de la Souris",
|
MouseEvents: "Êvénements de la Souris",
|
||||||
MenuAndMouse: "Les Êvénements de Menu et de la Souris",
|
MenuAndMouse: "Êvénements de Menu et de la Souris",
|
||||||
FontPrefs: "Préférences des Polices",
|
FontPrefs: "Préférences des Polices",
|
||||||
ForHTMLCSS: "Pour le HTML-CSS:",
|
ForHTMLCSS: "Pour le HTML-CSS:",
|
||||||
Auto: "Auto",
|
Auto: "Auto",
|
||||||
TeXLocal: "TeX (local)",
|
TeXLocal: "TeX (locales)",
|
||||||
TeXWeb: "TeX (web)",
|
TeXWeb: "TeX (web)",
|
||||||
TeXImage: "TeX (image)",
|
TeXImage: "TeX (image)",
|
||||||
STIXLocal: "STIX (local)",
|
STIXLocal: "STIX (locales)",
|
||||||
ContextMenu: "Menu Contextuel",
|
ContextMenu: "Menu Contextuel",
|
||||||
Browser: "Navigateur",
|
Browser: "Navigateur",
|
||||||
Scale: "Ajuster tous les Maths ...",
|
Scale: "Mise à l'échelle des formules ...",
|
||||||
Discoverable: "Mettez en Surbrillance lors de Survol",
|
Discoverable: "Mettez en Surbrillance lors du Survol",
|
||||||
About: "À propos de MathJax",
|
About: "À Propos de MathJax",
|
||||||
Help: "Aide MathJax",
|
Help: "Aide MathJax",
|
||||||
|
|
||||||
localTeXfonts: "utilisant les polices locales TeX",
|
localTeXfonts: "utilisant les polices locales TeX",
|
||||||
|
@ -60,7 +60,7 @@ MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
|
||||||
"les expressions mathématiques.",
|
"les expressions mathématiques.",
|
||||||
|
|
||||||
MSIENativeMMLWarning:
|
MSIENativeMMLWarning:
|
||||||
"Internet Explorer a besoin de module complémentaire MathPlayer " +
|
"Internet Explorer a besoin du module complémentaire MathPlayer " +
|
||||||
"pour afficher le MathML.",
|
"pour afficher le MathML.",
|
||||||
|
|
||||||
OperaNativeMMLWarning:
|
OperaNativeMMLWarning:
|
||||||
|
@ -84,7 +84,7 @@ MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
|
||||||
|
|
||||||
ScaleMath:
|
ScaleMath:
|
||||||
"Mise à l'échelle des expressions mathématiques (par rapport au " +
|
"Mise à l'échelle des expressions mathématiques (par rapport au " +
|
||||||
"text environnant) de %1%%",
|
"text environnant) de",
|
||||||
|
|
||||||
NonZeroScale:
|
NonZeroScale:
|
||||||
"L'échelle ne peut être nulle",
|
"L'échelle ne peut être nulle",
|
||||||
|
|
|
@ -25,27 +25,14 @@ MathJax.Hub.Insert(MathJax.Localization.strings.fr,{
|
||||||
|
|
||||||
LoadFailed: "Échec du téléchargement de %1",
|
LoadFailed: "Échec du téléchargement de %1",
|
||||||
|
|
||||||
CantLoadWebFont: "Impossible de télécharcharger la police Web %1",
|
ProcessMath: "Traitement des formules: %1%%",
|
||||||
|
|
||||||
ProcessMath: "Traitement des maths: %1%%",
|
|
||||||
|
|
||||||
Processing: "Traitement",
|
Processing: "Traitement",
|
||||||
|
|
||||||
TypesetMath: "Composition des maths: %1%%",
|
TypesetMath: "Composition des formules: %1%%",
|
||||||
|
|
||||||
Typesetting: "Composition",
|
Typesetting: "Composition",
|
||||||
|
|
||||||
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:
|
MathJaxNotSupported:
|
||||||
"Votre navigateur ne supporte pas MathJax"
|
"Votre navigateur ne supporte pas MathJax"
|
||||||
|
|
||||||
|
@ -55,7 +42,8 @@ MathJax.Hub.Insert(MathJax.Localization.strings.fr,{
|
||||||
FontWarnings: {},
|
FontWarnings: {},
|
||||||
"v1.0-warning": {},
|
"v1.0-warning": {},
|
||||||
TeX: {},
|
TeX: {},
|
||||||
MathML: {}
|
MathML: {},
|
||||||
|
"HTML-CSS": {}
|
||||||
},
|
},
|
||||||
|
|
||||||
plural: function(n) {
|
plural: function(n) {
|
||||||
|
@ -64,7 +52,7 @@ MathJax.Hub.Insert(MathJax.Localization.strings.fr,{
|
||||||
},
|
},
|
||||||
|
|
||||||
number: function(n) {
|
number: function(n) {
|
||||||
return n.replace(".", ","); // replace dot by comma
|
return String(n).replace(".", ","); // replace dot by comma
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,11 +3,11 @@ MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
|
||||||
isLoaded: true,
|
isLoaded: true,
|
||||||
strings: {
|
strings: {
|
||||||
MissingConfig:
|
MissingConfig:
|
||||||
"%1 MathJax ne charge plus de fichier de configuration par défaut; "+
|
"MathJax ne charge plus de fichier de configuration par défaut; "+
|
||||||
"vous devez spécifier ces fichiers de façons explicites. Cette "+
|
"vous devez spécifier ces fichiers de façons explicites. Cette "+
|
||||||
"page semble utiliser l'ancien fichier de configuration par "+
|
"page semble utiliser l'ancien fichier de configuration par "+
|
||||||
"défaut %2 and doit donc être mise à jour. Ceci est expliqué "+
|
"défaut %1 and doit donc être mise à jour. Ceci est expliqué "+
|
||||||
"en détails à l'addresse suivante: %3"
|
"en détails à l'addresse suivante: %2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user