better export notation and exporting reloadLang in case it has to be done manually
This commit is contained in:
parent
6674505ca8
commit
85523a56d9
@ -22,7 +22,7 @@ let langs;
|
|||||||
*
|
*
|
||||||
* @return :string The translated text
|
* @return :string The translated text
|
||||||
*/
|
*/
|
||||||
function i18n(key, options) {
|
export default function i18n(key, options) {
|
||||||
let ret = langs[key];
|
let ret = langs[key];
|
||||||
if(options != null){
|
if(options != null){
|
||||||
for (let key in options) {
|
for (let key in options) {
|
||||||
@ -32,9 +32,6 @@ function i18n(key, options) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default i18n;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Those functions are utility functions use by previous exported functions.
|
// Those functions are utility functions use by previous exported functions.
|
||||||
//
|
//
|
||||||
@ -60,7 +57,7 @@ function getCookie(key){
|
|||||||
* @param select the language to load. could be null to fetch the cookies for an answer
|
* @param select the language to load. could be null to fetch the cookies for an answer
|
||||||
* if nothing is found. default to EN.txt
|
* if nothing is found. default to EN.txt
|
||||||
*/
|
*/
|
||||||
async function loadLangs(lang){
|
export async function loadLangs(lang){
|
||||||
lang = lang != null ? lang : getCookie("lang");
|
lang = lang != null ? lang : getCookie("lang");
|
||||||
lang = lang != "" ? lang : default_lang;
|
lang = lang != "" ? lang : default_lang;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user