1
0
Fork 0
forked from OpenNeo/impress

make en-MEEP translatable - because sorting by translations doesnt work well with fallbacks

This commit is contained in:
Emi Matchu 2013-01-27 20:43:08 -06:00
parent 58bb3aa8f6
commit 6c3ff09f5d
3 changed files with 5 additions and 4 deletions

View file

@ -23,7 +23,7 @@ class Pet < ActiveRecord::Base
I18n.with_locale(options[:locale]) do
require 'ostruct'
begin
neopets_language_code = I18n.neopets_language_code_for(options[:locale])
neopets_language_code = I18n.compatible_neopets_language_code_for(options[:locale])
envelope = PET_VIEWER.request([name, 0]).post(
:timeout => 2,
:headers => {

View file

@ -52,7 +52,8 @@ module I18n
LocaleMeta::USABLE_LOCALES_WITH_NEOPETS_LANGUAGE_CODE
end
def self.neopets_language_code_for(locale)
LocaleMeta::NEOPETS_LANGUAGE_CODES_BY_LOCALE[locale]
def self.compatible_neopets_language_code_for(locale)
LocaleMeta::NEOPETS_LANGUAGE_CODES_BY_LOCALE[locale] ||
LocaleMeta::NEOPETS_LANGUAGE_CODES_BY_LOCALE[LocaleMeta::COMPATIBLE_LOCALES[locale]]
end
end

View file

@ -48,7 +48,7 @@ namespace :translate do
def with_given_locale
I18n.with_locale(ENV['LOCALE']) do
language_code = I18n.neopets_language_code_for(I18n.locale)
language_code = I18n.compatible_neopets_language_code_for(I18n.locale)
unless language_code
raise "Locale #{I18n.locale.inspect} has no neopets language code"
end