diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-03 06:10:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-03 06:10:07 +0300 |
commit | 036de62f732d946bba13be217f5d86fe65638dc5 (patch) | |
tree | d0d1bd3919bd513e41bd7a77260086836fc8e1ed /lib/gitlab/i18n.rb | |
parent | 86b7e30423820a05997039fd2af8aa2b0063953b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/i18n.rb')
-rw-r--r-- | lib/gitlab/i18n.rb | 56 |
1 files changed, 15 insertions, 41 deletions
diff --git a/lib/gitlab/i18n.rb b/lib/gitlab/i18n.rb index 12a3878e966..3b19ae3d7ff 100644 --- a/lib/gitlab/i18n.rb +++ b/lib/gitlab/i18n.rb @@ -4,6 +4,20 @@ module Gitlab module I18n extend self + # Languages with less then 2% of available translations will not + # be available in the UI. + # https://gitlab.com/gitlab-org/gitlab/-/issues/221012 + NOT_AVAILABLE_IN_UI = %w[ + fil_PH + pl_PL + nl_NL + id_ID + cs_CZ + bg + eo + gl_ES + ].freeze + AVAILABLE_LANGUAGES = { 'bg' => 'Bulgarian - български', 'cs_CZ' => 'Czech - čeština', @@ -28,49 +42,9 @@ module Gitlab 'zh_HK' => 'Chinese, Traditional (Hong Kong) - 繁體中文 (香港)', 'zh_TW' => 'Chinese, Traditional (Taiwan) - 繁體中文 (台灣)' }.freeze - private_constant :AVAILABLE_LANGUAGES - - # Languages with less then MINIMUM_TRANSLATION_LEVEL% of available translations will not - # be available in the UI. - # https://gitlab.com/gitlab-org/gitlab/-/issues/221012 - MINIMUM_TRANSLATION_LEVEL = 2 - - # Currently monthly updated manually by ~group::import PM. - # https://gitlab.com/gitlab-org/gitlab/-/issues/18923 - TRANSLATION_LEVELS = { - 'bg' => 1, - 'cs_CZ' => 1, - 'de' => 20, - 'en' => 100, - 'eo' => 1, - 'es' => 44, - 'fil_PH' => 1, - 'fr' => 14, - 'gl_ES' => 1, - 'id_ID' => 0, - 'it' => 3, - 'ja' => 49, - 'ko' => 15, - 'nl_NL' => 1, - 'pl_PL' => 1, - 'pt_BR' => 23, - 'ru' => 34, - 'tr_TR' => 18, - 'uk' => 46, - 'zh_CN' => 78, - 'zh_HK' => 3, - 'zh_TW' => 4 - }.freeze - private_constant :TRANSLATION_LEVELS def selectable_locales - @selectable_locales ||= AVAILABLE_LANGUAGES.reject do |code, _name| - percentage_translated_for(code) < MINIMUM_TRANSLATION_LEVEL - end - end - - def percentage_translated_for(code) - TRANSLATION_LEVELS.fetch(code, 0) + AVAILABLE_LANGUAGES.reject { |key, _value| NOT_AVAILABLE_IN_UI.include? key } end def available_locales |