lib/world_flags/util/language.rb in world-flags-0.3.6 vs lib/world_flags/util/language.rb in world-flags-0.4.0
- old
+ new
@@ -2,22 +2,23 @@
module Util
module Language
attr_writer :languages_map
def language_label code, locale
- WorldFlags.language code, locale
+ language code, locale
end
def language code = :us, locale = :en
locale ||= default_locale_used
+ locale = WorldFlags.locale(locale).to_sym
locale_languages_map = languages_map[locale] || languages_map[default_locale_used]
locale_languages_map = languages_map[:en] if locale_languages_map.blank?
raise "No language-locale map defined for locale: #{locale} or :en in #{languages.inspect}" if locale_languages_map.blank?
# raise("No language map defined for language code: #{code} in #{locale_languages_map[code]}")
- locale_languages_map[code] ? locale_languages_map[code] : locale_languages_map[default_code_used]
+ locale_languages_map[code] ? locale_languages_map[code] : locale_languages_map[default_code_used]
rescue Exception => e
raise e if WorldFlags.raise_error?
"Undefined"
end
\ No newline at end of file