lib/i18n/tasks/configuration.rb in i18n-tasks-0.3.3 vs lib/i18n/tasks/configuration.rb in i18n-tasks-0.3.4
- old
+ new
@@ -43,15 +43,18 @@
scanner: scanner.class.name,
config: scanner.config
}
end
- # @return [Array<String>] all available locales
+ # @return [Array<String>] all available locales, base_locale is always first
def locales
@config_sections[:locales] ||= begin
locales = (config[:locales] || I18n.available_locales).map(&:to_s)
- locales = [base_locale] + locales unless locales.include?(base_locale)
- locales
+ if locales.include?(base_locale)
+ [base_locale] + (locales - [base_locale])
+ else
+ [base_locale] + locales
+ end
end
end
# @return [String] default i18n locale
def base_locale