1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-18 20:59:43 +02:00

Select user language before server language

This commit is contained in:
Harvey Kandola 2022-03-21 13:14:55 -04:00
parent e81cbad385
commit 7e26c003d6
3 changed files with 13 additions and 3 deletions

View file

@ -30,7 +30,7 @@
<div class="{{unless invalidCredentials "invisible"}} color-red-600 mt-3"></div>
{{#if isAuthProviderDocumize}}
{{#link-to "auth.forgot"}}{{localize 'forgor_password'}}{{/link-to}}
{{#link-to "auth.forgot"}}{{localize 'forgot_password'}}{{/link-to}}
{{/if}}
</form>
</div>

View file

@ -24,14 +24,15 @@ export default Service.extend({
let str = "";
switch(this.session.locale) {
case "fr-FR":
str = "";
case "en-US":
str = this.langs.enUS[key];
break;
default:
str = this.langs.enUS[key];
}
if (_.isUndefined(str)) {
// eslint-disable-next-line no-console
console.log(">>>>>>>>>>>> i18n missed key", key);
return `!${key}!`;
}
@ -42,6 +43,8 @@ export default Service.extend({
}
}
console.log(this.session.locale);
return str;
},
});

View file

@ -100,8 +100,15 @@ export default SimpleAuthSession.extend({
}),
locale: computed('session.content.authenticated.user', function () {
if (this.get('session.authenticator') === 'authenticator:anonymous' ||
this.get('session.content.authenticated.user.id') === '0' ) {
return this.appMeta.locale;
}
let locale = this.get('session.content.authenticated.user.locale');
if (_.isUndefined(locale) || locale === "") return this.appMeta.locale;
return locale;
}),
init() {