pet states know their localized description

This commit is contained in:
Emi Matchu 2013-01-31 19:11:15 -06:00
parent 9efd2fe83a
commit 5985e234da
4 changed files with 37 additions and 4 deletions

View file

@ -39,7 +39,7 @@ gem 'sanitize', '~> 2.0.3'
gem 'newrelic_rpm' gem 'newrelic_rpm'
gem 'neopets', :git => 'git://github.com/matchu/neopets.git' gem 'neopets', '~> 0.2.0', :git => 'git://github.com/matchu/neopets.git'
gem "mini_magick", "~> 3.4" gem "mini_magick", "~> 3.4"

View file

@ -55,9 +55,9 @@ GIT
GIT GIT
remote: git://github.com/matchu/neopets.git remote: git://github.com/matchu/neopets.git
revision: d33aaf63d4617d9236ef0d99452b3bdc577cbc8e revision: 5d13a720b616ba57fbbd54541f3e5daf02b3fedc
specs: specs:
neopets (0.1.0) neopets (0.2.0)
nokogiri (~> 1.5.2) nokogiri (~> 1.5.2)
GIT GIT
@ -301,7 +301,7 @@ DEPENDENCIES
msgpack (~> 0.4.3) msgpack (~> 0.4.3)
mysql2 (< 0.3) mysql2 (< 0.3)
mysqlplus! mysqlplus!
neopets! neopets (~> 0.2.0)!
newrelic_rpm newrelic_rpm
nokogiri (~> 1.5.2) nokogiri (~> 1.5.2)
openneo-auth-signatory (~> 0.1.0) openneo-auth-signatory (~> 0.1.0)

View file

@ -103,6 +103,27 @@ class PetState < ActiveRecord::Base
def mood def mood
Neopets::Pet::Mood.find(self.mood_id) Neopets::Pet::Mood.find(self.mood_id)
end end
def gender_name
if female?
I18n.translate("pet_states.description.gender.female")
else
I18n.translate("pet_states.description.gender.male")
end
end
def mood_name
I18n.translate("pet_states.description.mood.#{mood.name}")
end
def gender_mood_description
if labeled?
I18n.translate('pet_states.description.main', :gender => gender_name,
:mood => mood_name)
else
I18n.translate('pet_states.description.unlabeled')
end
end
def self.from_pet_type_and_biology_info(pet_type, info) def self.from_pet_type_and_biology_info(pet_type, info)
swf_asset_ids = [] swf_asset_ids = []

View file

@ -706,6 +706,18 @@ en:
clone: Edit a copy clone: Edit a copy
creation_summary_html: Created by %{user_link}, %{created_at_ago} ago creation_summary_html: Created by %{user_link}, %{created_at_ago} ago
pet_states:
description:
main: "%{mood} %{gender}"
gender:
female: Female
male: Male
mood:
happy: Happy
sad: Sad
sick: Sick
unlabeled: Unlabeled
pets: pets:
bulk: bulk:
needed_items: needed_items: