Class: PluralForms

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_translation_manager/locale_checker/plural_forms.rb

Class Method Summary collapse

Class Method Details

.allObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rails_translation_manager/locale_checker/plural_forms.rb', line 4

def self.all
  I18n.available_locales.each_with_object({}) do |locale, hsh|
    begin
      # fetches plural form (rule) from rails-i18n or config/locales/plurals.rb for locale
      plural_form = I18n.with_locale(locale) { I18n.t!("i18n.plural.keys") }.sort
    rescue I18n::MissingTranslationData
      plural_form = nil
    end

    hsh[locale.downcase] = plural_form
  end
end