[FIX] Default server language not being applied#11719
Conversation
39fb9ec to
8bfa598
Compare
client/startup/i18n.js
Outdated
| const applyLanguage = (language = 'en') => { | ||
| if (!language) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Is it needed? The language argument is always set.
There was a problem hiding this comment.
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
| 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.
I've to read this line five times before get it... 🐛
There was a problem hiding this comment.
😂 the diff didn't help =P
|
|
||
| if (userLanguage && userLanguage !== currentLanguage.get()) { | ||
| setLanguage(userLanguage); | ||
| } |
There was a problem hiding this comment.
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.
actually setLanguage is still being called by the login form:
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.