diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 80205215..a2fb0905 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -162,6 +162,32 @@ module ApplicationHelper content_for :title, value end + def translate_with_links(key, options={}) + nonlink_options = {} + link_urls = {} + + options.each do |key, value| + str_key = key.to_s + if str_key.end_with? '_link_url' + link_key = str_key[0..-5] # "abcdef_link_url" => "abcdef_link" + link_urls[link_key] = value + else + nonlink_options[key] = value + end + end + + link_options = {} + link_urls.each do |link_key, url| + content = translate("#{key}.#{link_key}_content", nonlink_options) + link_options[link_key.to_sym] = link_to(content, url) + end + + converted_options = link_options.merge(nonlink_options) + translate("#{key}.main_html", converted_options) + end + + alias_method :twl, :translate_with_links + def userbar_contributions_summary(user) contributions_link_content = translate('.userbar.contributions_link_content', :user_points => user.points) diff --git a/app/views/outfits/index.html.haml b/app/views/outfits/index.html.haml index bd5bd07e..1858c578 100644 --- a/app/views/outfits/index.html.haml +++ b/app/views/outfits/index.html.haml @@ -1,22 +1,11 @@ -- title 'Your outfits' -%p - These are the outfits that you've saved to Dress to Impress so far. To save - some more, head to the wardrobe and click Save Outfit in the top right - corner. -%p - The link for each outfit is totally public, so please feel free to share the - URL with the whole wide world. +- title t('.title') + - unless @outfits.empty? + %p= t '.intro.saving' + %p= t '.intro.linking' %ul#outfits= render @outfits - else - %p - You haven't saved any outfits yet. - - succeed ',' do - = link_to 'Start at the home page', root_path - enter a pet name or choose a color combination, create the outfit of your - dreams, and click "Save Outfit" in the top right corner. - %p - It'll be fantastic. Promise. + %p= twl '.no_outfits', :start_link_url => root_path - content_for :javascripts do = include_javascript_libraries :jquery diff --git a/config/locales/en.yml b/config/locales/en.yml index dab1c900..0ae2d958 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -442,6 +442,24 @@ en: destroy: success: Outfit "%{outfit_name}" successfully deleted. + index: + title: Your Outfits + intro: + saving: + These are the outfits that you've saved to Dress to Impress so far. + When you design an outfit you like, click Save Outfit in the top + right corner and it'll appear in this list. + linking: + The link for each outfit is totally public, so feel free to share + them with the world. + no_outfits: + main_html: + You haven't saved any outfits yet. %{start_link}, enter a pet's name + or choose a color combination, create the outfit of your dreams, and + click "Save Outfit" in the top right corner. It'll be great, I + promise. + start_link_content: Start at the home page + new: tagline: Neopets wearables made easy! load_pet_legend: Enter your pet's name