Module: TrustyCms::AvailableLocales
- Defined in:
- lib/trusty_cms/available_locales.rb
Class Method Summary collapse
-
.locales ⇒ Object
Returns the list of available locale files in options_for_select format.
Class Method Details
.locales ⇒ Object
Returns the list of available locale files in options_for_select format.
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/trusty_cms/available_locales.rb', line 4 def self.locales available_locales = {} TrustyCms.configuration.i18n.load_path.each do |path| if File.exist?(path) && path !~ /_available_tags/ locale_yaml = YAML.load_file(path) stem = File.basename(path, '.yml') if locale_yaml[stem] && lang = locale_yaml[stem]['this_file_language'] available_locales[lang] = stem end end end available_locales.collect { |k, v| [k, v] }.sort_by { |s| s[0] } end |