From 8369ad0530e7d826b696bf4716d0836bb6c3abad Mon Sep 17 00:00:00 2001 From: Maroxy Date: Sat, 23 Oct 2021 15:38:29 +0200 Subject: [PATCH] add comment --- src/ts/i18n.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ts/i18n.ts b/src/ts/i18n.ts index bb26f29..bf0470c 100644 --- a/src/ts/i18n.ts +++ b/src/ts/i18n.ts @@ -22,8 +22,8 @@ i18n.prototype.translate = function(phrase: any) { } i18n.prototype.updatelang = function(newlang: string) { + // Test if the locale is the same string so if it's de-de or id-id remove -de or -id like navigator.language does. let samecode = new RegExp(`(${newlang.toLowerCase().replace(/-.*$/, '')}.*){2}`, 'g'); - samecode.test(newlang.toLowerCase()) ? newlang = newlang.toLowerCase().replace(/-.*$/, '') : newlang = newlang.toLowerCase(); if(fs.existsSync(path.join(path.dirname(__dirname), 'locales', newlang + '.json'))) {