Fix global 'locale' variable

pull/145/head
Gordon Williams 2020-03-25 22:36:46 +00:00
parent 755580f092
commit a7109b4fbd
3 changed files with 17 additions and 17 deletions

View File

@ -40,7 +40,7 @@
{ "id": "locale",
"name": "Languages",
"icon": "locale.png",
"version":"0.02",
"version":"0.03",
"description": "Translations for different countries",
"tags": "tool,system,locale,translate",
"type": "locale",

View File

@ -1,2 +1,3 @@
0.01: New App!
0.02: Fix locale.currencySym
0.03: Fix global 'locale' variable

View File

@ -60,22 +60,21 @@
});
var app = `
locale = ${JSON.stringify(locales[lang])};
exports = {
lang: locale.lang,
currencySym: locale.currency_symbol,
dow: (d,short) => {day = d.getDay();return (short) ? locale.abday.split(",")[day] : locale.day.split(",")[day];},
month: (d,short) => { month = d.getMonth(); return (short) ? locale.abmonth.split(",")[month] : locale.month.split(",")[month];},
number: n => n.toString().replace(locale.thousands_sep, locale.decimal_point),
currency: n => n.toFixed(2).replace(locale.thousands_sep, locale.decimal_point) + locale.currency_symbol,
distance: n => (n < 1000) ? Math.round(n) + locale.distance[0] : Math.round(n/1000) + locale.distance[1],
speed: s => Math.round(s) +locale.speed,
temp: t => Math.round(t) + locale.temperature,
translate: s => {s=""+s;return locale.trans[s]||locale.trans[s.toLowerCase()]||s},
date: (d,short) => (short) ? \`${dateS}\`: \`${dateN}\`,
time: (d,short) => (short) ? \`${timeS}\`: \`${timeN}\`,
};`;
var app = `var locale = ${JSON.stringify(locales[lang])};
exports = {
lang: locale.lang,
currencySym: locale.currency_symbol,
dow: (d,short) => {day = d.getDay();return (short) ? locale.abday.split(",")[day] : locale.day.split(",")[day];},
month: (d,short) => { month = d.getMonth(); return (short) ? locale.abmonth.split(",")[month] : locale.month.split(",")[month];},
number: n => n.toString().replace(locale.thousands_sep, locale.decimal_point),
currency: n => n.toFixed(2).replace(locale.thousands_sep, locale.decimal_point) + locale.currency_symbol,
distance: n => (n < 1000) ? Math.round(n) + locale.distance[0] : Math.round(n/1000) + locale.distance[1],
speed: s => Math.round(s) +locale.speed,
temp: t => Math.round(t) + locale.temperature,
translate: s => {s=""+s;return locale.trans[s]||locale.trans[s.toLowerCase()]||s},
date: (d,short) => (short) ? \`${dateS}\`: \`${dateN}\`,
time: (d,short) => (short) ? \`${timeS}\`: \`${timeN}\`,
};`;
sendCustomizedApp({
storage:[