New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] Default server language not being applied #11719
Conversation
39fb9ec
to
8bfa598
Compare
client/startup/i18n.js
Outdated
@@ -41,6 +41,9 @@ Meteor.startup(() => { | |||
}); | |||
|
|||
const applyLanguage = (language = 'en') => { | |||
if (!language) { | |||
return; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it needed? The language
argument is always set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true.. during the development I got one situation where the param was null
but with current implementation it is always set.. I'll remove this. thx
client/startup/i18n.js
Outdated
if (userLanguage && userLanguage !== currentLanguage.get()) { | ||
setLanguage(userLanguage); | ||
} | ||
const user = RocketChat.models.Users.findOne(Meteor.userId(), { fields: { language: 1 }}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've to read this line five times before get it... 🐛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂 the diff didn't help =P
client/startup/i18n.js
Outdated
|
||
if (userLanguage && userLanguage !== currentLanguage.get()) { | ||
setLanguage(userLanguage); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a side effect of not invoking setLanguage()
, the reactive currentLanguage
variable is not changed and the form login will always show a suggested language. When nor user and admin language are set, e.g., the English version
link is always present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually setLanguage
is still being called by the login form:
window.setLanguage(language); |
this is the only place that still calls it.
@tassoevan pls review it again =) |
* Fix default server language not being applied * Always set user's language on localStorage
With the new logic, the user's language takes precedence, then the language stored on
localStorage
, then default server's language.