added language codes map

This commit is contained in:
MrZYX 2010-11-18 20:57:33 +01:00 committed by Raphael
parent 60375422e7
commit dcbcaefcbe
4 changed files with 15 additions and 3 deletions

View file

@ -18,6 +18,12 @@ else
AVAILABLE_LANGUAGE_CODES = ['en']
end
if File.exists?(File.expand_path("./config/langcodes_alias_map.yml"))
LANGUAGE_CODES_MAP = YAML::load(File.open(File.expand_path("./config/langcodes_alias_map.yml")))
else
LANGUAGE_CODES_MAP = {}
end
# Initialize the rails application
Diaspora::Application.initialize!

View file

@ -7,5 +7,10 @@ I18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
I18n.default_locale = DEFAULT_LANGUAGE
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
AVAILABLE_LANGUAGE_CODES.each do |c|
I18n.fallbacks[c.to_sym] = [c.to_sym, DEFAULT_LANGUAGE.to_sym, :en]
end
if LANGUAGE_CODES_MAP.key?(c)
I18n.fallbacks[c.to_sym] = LANGUAGE_CODES_MAP[c]
I18n.fallbacks[c.to_sym].concat([c.to_sym, DEFAULT_LANGUAGE.to_sym, :en])
else
I18n.fallbacks[c.to_sym] = [c.to_sym, DEFAULT_LANGUAGE.to_sym, :en]
end
end

View file

@ -0,0 +1,2 @@
en: [:en-US, :en-GB]
sv: [:sv-SE]

View file

@ -1 +0,0 @@
en-US.yml