Module: Kaui::LocaleHelper

Defined in:
app/helpers/kaui/locale_helper.rb

Instance Method Summary collapse

Instance Method Details

#get_available_localesObject


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/kaui/locale_helper.rb', line 4

def get_available_locales
  locale_yaml_file = File.join(File.dirname(__FILE__), 'locale_helper.yml')
  available_locales = YAML::load_file(locale_yaml_file)

  favorites = []
  locales = []

  available_locales.each do |locale|
    option = ["#{locale[:language]} #{locale[:country]} (#{locale[:language_tag]})", locale[:language_tag] ]
    locales << option unless locale[:favorite]
    favorites << option if locale[:favorite]
  end

  favorites.concat(['---------------']).concat(locales)
end