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 I18n.with_locale(options[:locale]) do
require 'ostruct' require 'ostruct'
begin 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( envelope = PET_VIEWER.request([name, 0]).post(
:timeout => 2, :timeout => 2,
:headers => { :headers => {

View file

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

View file

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