Started segmenting formula wizard, Prepared for PHP minifaction
Update .gitignore, .htaccess, and 38 more files...
This commit is contained in:
75
tools/items/formula-wizard/src/lang.ts
Normal file
75
tools/items/formula-wizard/src/lang.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
// TODO: Move into a common lib with parameter support !
|
||||
|
||||
export const langKey= document.documentElement.lang.match("(en|fr)") ? document.documentElement.lang : "en";
|
||||
|
||||
const langData = {
|
||||
en: {
|
||||
"unit.any.name": "Not Important",
|
||||
"unit.watt.name": "Watt",
|
||||
"unit.ampere.name": "Ampere",
|
||||
"unit.ohm.name": "Ohm",
|
||||
"unit.ohm.desc": "Electrical Resistance",
|
||||
"unit.volt.name": "Volt",
|
||||
"unit.farad.name": "Farad",
|
||||
"error.formulaValue.noParent": "Attempting to get a formula's value whose parent formula isn't set !",
|
||||
"error.formulaValue.noSource": "Attempting to get a formula's value whose value source is null !",
|
||||
"error.formulaContext.tooSmall": "The current calculation context is too small !",
|
||||
"ui.formulaCount": "formulas",
|
||||
"formula.ohm_law.name": "Ohm's Law",
|
||||
|
||||
"dataset.resistor-e3.name": "E3 IEC Resistors",
|
||||
"dataset.resistor-e3.desc": "???",
|
||||
"dataset.resistor-e6.name": "E6 IEC Resistors",
|
||||
"dataset.resistor-e6.desc": "???",
|
||||
"dataset.resistor-e12.name": "E12 IEC Resistors",
|
||||
"dataset.resistor-e12.desc": "???",
|
||||
"dataset.resistor-e24.name": "E24 IEC Resistors",
|
||||
"dataset.resistor-e24.desc": "???",
|
||||
"dataset.resistor-e48.name": "E48 IEC Resistors",
|
||||
"dataset.resistor-e48.desc": "???",
|
||||
|
||||
"dataset.capacitor-iec.name": "IEC E24 Capacitors",
|
||||
"dataset.capacitor-iec.desc": "???",
|
||||
|
||||
"context.type.disabled.name": "Disabled",
|
||||
"context.type.constant.name": "Constant",
|
||||
"context.type.continuous.name": "Continuous",
|
||||
"context.type.valueRange.name": "Value Range",
|
||||
"context.type.dataSetRange.name": "Set-based Range",
|
||||
"context.type.disabled.desc": "???",
|
||||
"context.type.constant.desc": "???",
|
||||
"context.type.continuous.desc": "???",
|
||||
"context.type.valueRange.desc": "???",
|
||||
"context.type.dataSetRange.desc": "???",
|
||||
|
||||
// "error.ui.context.component.missingElement"
|
||||
// "error.ui.context.component.cannotGetElement"
|
||||
},
|
||||
fr: {
|
||||
"unit.ampere.name": "Ampère",
|
||||
"unit.ohm.desc": "Résistance électrique",
|
||||
"_error.formulaValue.noParent": "",
|
||||
"_error.formulaValue.noSource": "",
|
||||
"ui.formulaCount": "formules",
|
||||
"formula.ohm_law.name": "Loi d'Ohm",
|
||||
|
||||
"context.type.disabled.name": "Désactivé",
|
||||
"context.type.constant.name": "Constante",
|
||||
"context.type.continuous.name": "Continue",
|
||||
"context.type.valueRange.name": "Valeurs distinctes",
|
||||
"context.type.dataSetRange.name": "Set de valeurs",
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Localizes a given `stringKey` into it's associated localized string.
|
||||
* @param stringKey - ???.
|
||||
*/
|
||||
export function localize(stringKey: string): string {
|
||||
// @ts-ignore -> Implicit any on "langData[langKey]"
|
||||
let _langData = langKey in langData ? langData[langKey] : langData.en;
|
||||
return stringKey in _langData ? _langData[stringKey] : (
|
||||
// @ts-ignore -> Implicit any on " langData["en"][stringKey]"
|
||||
stringKey in langData["en"] ? langData["en"][stringKey] : stringKey
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user