Class: SpreeI18n::Locale
- Inherits:
-
Object
- Object
- SpreeI18n::Locale
- Defined in:
- lib/spree_i18n/locale.rb
Class Method Summary collapse
Class Method Details
.all ⇒ Object
6 7 8 |
# File 'lib/spree_i18n/locale.rb', line 6 def all Dir["#{dir}/*.yml"].map { |f| File.basename(f, '.yml').to_sym } end |
.dir ⇒ Object
10 11 12 |
# File 'lib/spree_i18n/locale.rb', line 10 def dir File.join(File.dirname(__FILE__), '/../../config/locales') end |
.local_language_name(locale) ⇒ Object
14 15 16 17 |
# File 'lib/spree_i18n/locale.rb', line 14 def local_language_name(locale) @@language_names ||= CSV.read(File.join(__dir__, 'locales_and_local_language_names.csv')).to_h { |row| [row[0], row[2]] } @@language_names[locale.to_s.downcase] || @@language_names[locale.to_s.downcase.split('-').first] end |