diff options
-rw-r--r-- | config/environment.rb | 16 | ||||
-rw-r--r-- | config/langcodes_alias_map.yml | 8 | ||||
-rw-r--r-- | config/languages.yml | 35 | ||||
-rw-r--r-- | config/locale_settings.yml | 44 |
4 files changed, 50 insertions, 53 deletions
diff --git a/config/environment.rb b/config/environment.rb index d44c652f7..a64956a34 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -7,20 +7,16 @@ require File.expand_path('../application', __FILE__) Haml::Template.options[:format] = :html5 Haml::Template.options[:escape_html] = true -if File.exists?(File.expand_path("./config/languages.yml")) - languages = YAML::load(File.open(File.expand_path("./config/languages.yml"))) - AVAILABLE_LANGUAGES = (languages['available'].length > 0) ? languages['available'] : { :en => 'English' } - DEFAULT_LANGUAGE = (AVAILABLE_LANGUAGES.include?(languages['default'])) ? languages['default'] : AVAILABLE_LANGUAGES.keys[0].to_s - AVAILABLE_LANGUAGE_CODES = languages['available'].keys.map { |v| v.to_s } +if File.exists?(File.expand_path("./config/locale_settings.yml")) + locale_settings = YAML::load(File.open(File.expand_path("./config/locale_settings.yml"))) + AVAILABLE_LANGUAGES = (locale_settings['available'].length > 0) ? locale_settings['available'] : { :en => 'English' } + DEFAULT_LANGUAGE = (AVAILABLE_LANGUAGES.include?(locale_settings['default'])) ? locale_settings['default'] : AVAILABLE_LANGUAGES.keys[0].to_s + AVAILABLE_LANGUAGE_CODES = locale_settings['available'].keys.map { |v| v.to_s } + LANGUAGE_CODES_MAP = locale_settings['fallbacks'] else AVAILABLE_LANGUAGES = { :en => 'English' } DEFAULT_LANGUAGE = 'en' 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 diff --git a/config/langcodes_alias_map.yml b/config/langcodes_alias_map.yml deleted file mode 100644 index 7063cadd1..000000000 --- a/config/langcodes_alias_map.yml +++ /dev/null @@ -1,8 +0,0 @@ -en-GB: [:en] -en-US: [:en] -en_shaw: [:en, :en-GB, :en-US] -sv: [:sv-SE] -he: [:he-IL] -es-CL: [:es] -gl: [:gl-ES] -zh: [:zh-CN, :zh-TW] diff --git a/config/languages.yml b/config/languages.yml deleted file mode 100644 index 1e65bb531..000000000 --- a/config/languages.yml +++ /dev/null @@ -1,35 +0,0 @@ -default: 'en' -available: - ca: "Català" - cs: 'Čeština' - cy: 'Cymraeg' - da: 'Dansk' - de: 'Deutsch' - el: "Ελληνικά" - en: 'English' - en_shaw: '𐑦𐑙𐑤𐑦𐑖' - es: 'Español' - es-CL: 'Español Chileno' - eu: 'Euskara' - fi: 'Suomi' - fr: 'Français' - ga: 'Gaeilge' - gl: 'Galego' - he: 'עברית' - hu: 'magyar nyelv' - id: 'Bahasa Indonesia' - is: 'íslenska' - it: 'Italiano' - lt: 'Lietuviškai' - mk: 'македонски' - nb: 'Norske' - nl: 'Nederlands' - pl: "Polski" - pt-BR: 'Português' - ro: 'Română' - ru: 'Русский' - sl: 'Slovenščina' - sk: 'Slovenčina' - sv: 'Svenska' - tr: 'Türk' - zh: '中文' diff --git a/config/locale_settings.yml b/config/locale_settings.yml new file mode 100644 index 000000000..e012805f1 --- /dev/null +++ b/config/locale_settings.yml @@ -0,0 +1,44 @@ +default: 'en' +available: + ca: "Català" + cs: 'Čeština' + cy: 'Cymraeg' + da: 'Dansk' + de: 'Deutsch' + el: "Ελληνικά" + en: 'English' + en_shaw: '𐑦𐑙𐑤𐑦𐑖' + es: 'Español' + es-CL: 'Español Chileno' + eu: 'Euskara' + fi: 'Suomi' + fr: 'Français' + ga: 'Gaeilge' + gl: 'Galego' + he: 'עברית' + hu: 'magyar nyelv' + id: 'Bahasa Indonesia' + is: 'íslenska' + it: 'Italiano' + lt: 'Lietuviškai' + mk: 'македонски' + nb: 'Norske' + nl: 'Nederlands' + pl: "Polski" + pt-BR: 'Português' + ro: 'Română' + ru: 'Русский' + sl: 'Slovenščina' + sk: 'Slovenčina' + sv: 'Svenska' + tr: 'Türk' + zh: '中文' +fallbacks: + en-GB: [:en] + en-US: [:en] + en_shaw: [:en, :en-GB, :en-US] + sv: [:sv-SE] + he: [:he-IL] + es-CL: [:es] + gl: [:gl-ES] + zh: [:zh-CN, :zh-TW] |