[Revert] Feature: Set JH default language to zh_CN
Revert MR: https://gitlab.com/gitlab-jh/gitlab/-/merge_requests/182
Issue: https://gitlab.com/gitlab-jh/gitlab/-/issues/90
Upstream Dependency
-
[MR] Refactor user default preferred_language: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71125
Goal
-
Let system default language be 'zh_CN' -
Let the user's default language preference be 'zh_CN'
Background
The system stores the user's language information through preferred_language
on users
table.
This attribute of preferred_language
is missing in the user registration form ( POST /users
), User
model apply the
default value by:
default_value_for :preferred_language, I18n.default_locale
and read preferred_language
by method:
def preferred_language
read_attribute('preferred_language') ||
I18n.default_locale.to_s.presence_in(Gitlab::I18n.available_locales) ||
'en'
end
How
-
Override default locale value by initializer -
Override the preferred_language
ofUser
model
Note
Because there are lots of hard-code test cases in Upstream, I18n.default_locale
configuration is not applied in all test environment.
We only set this value in jh specific test cases.
Next Step
The current MR can only be regarded as a short-term plan.
The long-term plan should be based on issue Default language setting on hosted gitlab and Fix hard-coded test cases for configuring default language setting .