i18n for outfits#index - plus the translate_with_links helper, which can be used for refactoring other stuff
This commit is contained in:
parent
029373addd
commit
b346bcc6d9
3 changed files with 49 additions and 16 deletions
|
@ -162,6 +162,32 @@ module ApplicationHelper
|
||||||
content_for :title, value
|
content_for :title, value
|
||||||
end
|
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)
|
def userbar_contributions_summary(user)
|
||||||
contributions_link_content = translate('.userbar.contributions_link_content',
|
contributions_link_content = translate('.userbar.contributions_link_content',
|
||||||
:user_points => user.points)
|
:user_points => user.points)
|
||||||
|
|
|
@ -1,22 +1,11 @@
|
||||||
- title 'Your outfits'
|
- title t('.title')
|
||||||
%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.
|
|
||||||
- unless @outfits.empty?
|
- unless @outfits.empty?
|
||||||
|
%p= t '.intro.saving'
|
||||||
|
%p= t '.intro.linking'
|
||||||
%ul#outfits= render @outfits
|
%ul#outfits= render @outfits
|
||||||
- else
|
- else
|
||||||
%p
|
%p= twl '.no_outfits', :start_link_url => root_path
|
||||||
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.
|
|
||||||
|
|
||||||
- content_for :javascripts do
|
- content_for :javascripts do
|
||||||
= include_javascript_libraries :jquery
|
= include_javascript_libraries :jquery
|
||||||
|
|
|
@ -442,6 +442,24 @@ en:
|
||||||
destroy:
|
destroy:
|
||||||
success: Outfit "%{outfit_name}" successfully deleted.
|
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:
|
new:
|
||||||
tagline: Neopets wearables made easy!
|
tagline: Neopets wearables made easy!
|
||||||
load_pet_legend: Enter your pet's name
|
load_pet_legend: Enter your pet's name
|
||||||
|
|
Loading…
Reference in a new issue