Commit 7096acb4 authored by Stan Hu's avatar Stan Hu

Merge branch '214880-sort-the-language-list' into 'master'

Resolve "Sort the language list"

Closes #214880

See merge request gitlab-org/gitlab!29833
parents 50200a78 e942c0e4
......@@ -70,7 +70,7 @@ module PreferencesHelper
end
def language_choices
Gitlab::I18n::AVAILABLE_LANGUAGES.map { |value, label| [label, value] }
Gitlab::I18n::AVAILABLE_LANGUAGES.map(&:reverse).sort
end
private
......
......@@ -5,28 +5,28 @@ module Gitlab
extend self
AVAILABLE_LANGUAGES = {
'bg' => 'Bulgarian - български',
'cs_CZ' => 'Czech - čeština',
'de' => 'German - Deutsch',
'en' => 'English',
'es' => 'Español',
'gl_ES' => 'Galego',
'de' => 'Deutsch',
'fr' => 'Français',
'pt_BR' => 'Português (Brasil)',
'zh_CN' => '简体中文',
'zh_HK' => '繁體中文 (香港)',
'zh_TW' => '繁體中文 (臺灣)',
'bg' => 'български',
'ru' => 'Русский',
'eo' => 'Esperanto',
'it' => 'Italiano',
'uk' => 'Українська',
'ja' => '日本語',
'ko' => '한국어',
'nl_NL' => 'Nederlands',
'tr_TR' => 'Türkçe',
'id_ID' => 'Bahasa Indonesia',
'eo' => 'Esperanto - esperanto',
'es' => 'Spanish - español',
'fil_PH' => 'Filipino',
'pl_PL' => 'Polski',
'cs_CZ' => 'Čeština'
'fr' => 'French - français',
'gl_ES' => 'Galician - galego',
'id_ID' => 'Indonesian - Bahasa Indonesia',
'it' => 'Italian - italiano',
'ja' => 'Japanese - 日本語',
'ko' => 'Korean - 한국어',
'nl_NL' => 'Dutch - Nederlands',
'pl_PL' => 'Polish - polski',
'pt_BR' => 'Portuguese (Brazil) - português (Brasil)',
'ru' => 'Russian - Русский',
'tr_TR' => 'Turkish - Türkçe',
'uk' => 'Ukrainian - українська',
'zh_CN' => 'Chinese, Simplified - 简体中文',
'zh_HK' => 'Chinese, Traditional (Hong Kong) - 繁體中文 (香港)',
'zh_TW' => 'Chinese, Traditional (Taiwan) - 繁體中文 (台灣)'
}.freeze
def available_locales
......
......@@ -123,7 +123,7 @@ describe PreferencesHelper do
describe '#language_choices' do
it 'returns an array of all available languages' do
expect(helper.language_choices).to be_an(Array)
expect(helper.language_choices.map(&:second)).to eq(Gitlab::I18n.available_locales)
expect(helper.language_choices.map(&:first)).to eq(Gitlab::I18n::AVAILABLE_LANGUAGES.values.sort)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment