6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'app/helpers/preferred_language_switcher_helper.rb', line 6
def ordered_selectable_locales
highly_translated_languages = Gitlab::I18n.selectable_locales(SWITCHER_MINIMUM_TRANSLATION_LEVEL)
locale_list = highly_translated_languages.filter_map do |code, language|
percentage = Gitlab::I18n.percentage_translated_for(code)
{
value: code,
percentage: percentage,
text: language.split('-').last.strip
}
end
locale_list.sort_by { |item| item[:percentage] }.reverse
end
|