diff --git a/app/assets/javascripts/modeling.js.jsx b/app/assets/javascripts/modeling.js.jsx index f8b0f40d..074a2817 100644 --- a/app/assets/javascripts/modeling.js.jsx +++ b/app/assets/javascripts/modeling.js.jsx @@ -1,6 +1,6 @@ /** @jsx React.DOM */ -(function($) { +(function($, I18n) { // Console-polyfill. MIT license. // https://github.com/paulmillr/console-polyfill // Make it safe to do console.log() always. @@ -120,11 +120,10 @@ var equippedClosetId = equippedByZone[zoneId].closet_obj_id; var equippedObjectId = closetItems[equippedClosetId].obj_info_id; if (itemsById.hasOwnProperty(equippedObjectId)) { - // TODO: i18n title customization.statusByItemId[equippedObjectId] = "success"; itemsById[equippedObjectId].el.find("span[data-body-id=" + customization.custom_pet.body_id + "]").addClass("modeled") - .attr("title", "You just finished modeling this—thanks so much!"); + .attr("title", I18n.modeledBodyTitle); } }); this._customizationsByPetId[customization.custom_pet.name] = customization; @@ -294,18 +293,10 @@ } var itemName = this.props.item.name; var imageSrc = "http://pets.neopets.com/cpn/" + petName + "/1/1.png"; - // TODO: i18n - var title = "Submit " + petName + " as a model, especially if they're " + - "wearing the " + itemName + "!"; - if (status === "success") { - var statusMessage = "Thanks! <3"; - } else if (status === "unworn") { - var statusMessage = "Not wearing this item."; - } else if (status === "error") { - var statusMessage = "Couldn't load. Try again?"; - } else { - var statusMessage =""; - } + var title = I18n.pet.title + .replace(/%{pet}/g, petName) + .replace(/%{item}/g, itemName); + var statusMessage = I18n.pet.status[status] || ""; return
  • ; + ; }, handleChange: function(e) { this.setState({newUsername: e.target.value}); @@ -358,4 +349,4 @@ }); Modeling.init($); -})(jQuery); +})(jQuery, ModelingI18n); diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb index ed50c393..e05cac76 100644 --- a/app/helpers/outfits_helper.rb +++ b/app/helpers/outfits_helper.rb @@ -114,5 +114,16 @@ module OutfitsHelper options = {:spellcheck => false, :id => nil}.merge(options) text_field_tag 'name', nil, options end + + def modeling_i18n_tag + localized_cache('modeling_i18n') do + modeling_i18n = { + modeledBodyTitle: t('.newest_items.modeled.body_title'), + pet: t('.newest_items.modeled.pet'), + neopetsUsernamesForm: t('.newest_items.modeled.neopets_usernames_form') + } + haml_concat javascript_tag("var ModelingI18n = #{modeling_i18n.to_json};") + end + end end diff --git a/app/views/outfits/new.html.haml b/app/views/outfits/new.html.haml index 93af18b8..42bc0431 100644 --- a/app/views/outfits/new.html.haml +++ b/app/views/outfits/new.html.haml @@ -117,4 +117,5 @@ - content_for :javascripts do = include_javascript_libraries :jquery20, :jquery_tmpl + = modeling_i18n_tag = javascript_include_tag 'ajax_auth', 'react', 'jquery.timeago', 'pet_query', 'outfits/new', 'modeling' \ No newline at end of file diff --git a/config/locales/en-MEEP.yml b/config/locales/en-MEEP.yml index a521405d..cb5dd441 100644 --- a/config/locales/en-MEEP.yml +++ b/config/locales/en-MEEP.yml @@ -658,6 +658,16 @@ en-MEEP: last_word_connector: '! meep ' modeled: header: These items have already been meeped—meep for your help! + body_title: You just finished meeping this—meep so much! + neopets_usernames_form: + label: meepits username + submit: meep + pet: + status: + success: Meep! <3 + unworn: Not meeping this item. + error: Couldn't load. Meep again? + title: Meep %{pet} as a model, especially if they're meeping the %{item}! pet_query: notice_html: Thanks for meeping us %{pet_name}. diff --git a/config/locales/en.yml b/config/locales/en.yml index f28d3b8f..90cd1c67 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -713,6 +713,16 @@ en: last_word_connector: ', or ' modeled: header: These items have already been modeled—thanks for your help! + body_title: You just finished modeling this—thanks so much! + neopets_usernames_form: + label: neopets username + submit: add + pet: + status: + success: Thanks! <3 + unworn: Not wearing this item. + error: Couldn't load. Try again? + title: Submit %{pet} as a model, especially if they're wearing the %{item}! pet_query: notice_html: Thanks for showing us %{pet_name}.