forked from OpenNeo/impress
make en-MEEP translatable - because sorting by translations doesnt work well with fallbacks
This commit is contained in:
parent
58bb3aa8f6
commit
6c3ff09f5d
3 changed files with 5 additions and 4 deletions
|
@ -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 => {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue