Skip to content

[Revert] Feature: Set JH default language to zh_CN

Qian Zhang (Gary)请求将feat/set_jh_default_local_zh合并到main-jh

Revert MR: https://gitlab.com/gitlab-jh/gitlab/-/merge_requests/182

Issue: https://gitlab.com/gitlab-jh/gitlab/-/issues/90

Upstream Dependency

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 of User 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 .

Qian Zhang (Gary) 编辑于

合并请求报告

加载中