Module: I18n::Tasks::LocaleList
- Defined in:
- lib/i18n/tasks/locale_list.rb
Class Method Summary collapse
-
.normalize_locale_list(locales, base_locale, include_base = false) ⇒ Object
Locales converted to strings, with base locale first, the rest sorted alphabetically.
Class Method Details
.normalize_locale_list(locales, base_locale, include_base = false) ⇒ Object
Returns locales converted to strings, with base locale first, the rest sorted alphabetically.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/i18n/tasks/locale_list.rb', line 8 def normalize_locale_list(locales, base_locale, include_base = false) locales = Array(locales).map(&:to_s).sort if locales.include?(base_locale) [base_locale] + (locales - [base_locale]) elsif include_base [base_locale] + locales else locales end end |