mirror of
https://github.com/documize/community.git
synced 2025-07-20 05:39:42 +02:00
Select user language before server language
This commit is contained in:
parent
e81cbad385
commit
7e26c003d6
3 changed files with 13 additions and 3 deletions
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
<div class="{{unless invalidCredentials "invisible"}} color-red-600 mt-3"></div>
|
<div class="{{unless invalidCredentials "invisible"}} color-red-600 mt-3"></div>
|
||||||
{{#if isAuthProviderDocumize}}
|
{{#if isAuthProviderDocumize}}
|
||||||
{{#link-to "auth.forgot"}}{{localize 'forgor_password'}}{{/link-to}}
|
{{#link-to "auth.forgot"}}{{localize 'forgot_password'}}{{/link-to}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,14 +24,15 @@ export default Service.extend({
|
||||||
let str = "";
|
let str = "";
|
||||||
|
|
||||||
switch(this.session.locale) {
|
switch(this.session.locale) {
|
||||||
case "fr-FR":
|
case "en-US":
|
||||||
str = "";
|
str = this.langs.enUS[key];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
str = this.langs.enUS[key];
|
str = this.langs.enUS[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_.isUndefined(str)) {
|
if (_.isUndefined(str)) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(">>>>>>>>>>>> i18n missed key", key);
|
console.log(">>>>>>>>>>>> i18n missed key", key);
|
||||||
return `!${key}!`;
|
return `!${key}!`;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +43,8 @@ export default Service.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(this.session.locale);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -100,8 +100,15 @@ export default SimpleAuthSession.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
locale: computed('session.content.authenticated.user', function () {
|
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');
|
let locale = this.get('session.content.authenticated.user.locale');
|
||||||
if (_.isUndefined(locale) || locale === "") return this.appMeta.locale;
|
if (_.isUndefined(locale) || locale === "") return this.appMeta.locale;
|
||||||
|
|
||||||
|
return locale;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue