mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-19 16:33:04 +03:00
add comment
This commit is contained in:
parent
04b7b5abfe
commit
8369ad0530
1 changed files with 1 additions and 1 deletions
|
@ -22,8 +22,8 @@ i18n.prototype.translate = function(phrase: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
i18n.prototype.updatelang = function(newlang: string) {
|
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');
|
let samecode = new RegExp(`(${newlang.toLowerCase().replace(/-.*$/, '')}.*){2}`, 'g');
|
||||||
|
|
||||||
samecode.test(newlang.toLowerCase()) ? newlang = newlang.toLowerCase().replace(/-.*$/, '') : newlang = newlang.toLowerCase();
|
samecode.test(newlang.toLowerCase()) ? newlang = newlang.toLowerCase().replace(/-.*$/, '') : newlang = newlang.toLowerCase();
|
||||||
|
|
||||||
if(fs.existsSync(path.join(path.dirname(__dirname), 'locales', newlang + '.json'))) {
|
if(fs.existsSync(path.join(path.dirname(__dirname), 'locales', newlang + '.json'))) {
|
||||||
|
|
Loading…
Reference in a new issue