Merge pull request #12227 from pedrobmarin/fix-guest-navigator-language

fix(guest): navigator language
This commit is contained in:
Anton Georgiev 2021-05-02 09:12:04 -04:00 committed by GitHub
commit 613e24665e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,7 +61,7 @@
</style>
<script type="text/javascript" role="l10n">
tr = {
const tr = {
"en": {
"app.errorSeeConsole": "Error: more details in the console.",
"app.noModeratorResponse": "No response from Moderator.",
@ -117,18 +117,12 @@
}
function _(message) {
lang = navigator.language;
// handle de-DE, en-US
if (pos = lang.indexOf('-') > -1) {
lang = lang.substr(0, pos);
}
if (tr[lang] == undefined) {
lang = "en";
}
msg = tr[lang][message];
if (msg === undefined) {
msg = tr["en"][message];
}
let lang = navigator.language.split(/[-_]/)[0];
if (!tr[lang]) lang = "en";
let msg = tr[lang][message];
if (!msg) msg = tr["en"][message];
return msg;
}