1
0
Fork 0
forked from OpenNeo/impress

i18n the unmodeled newest items content

This commit is contained in:
Emi Matchu 2013-12-30 10:55:49 -05:00
parent 949fa2a77a
commit 1b0a636fab
3 changed files with 28 additions and 5 deletions

View file

@ -55,9 +55,10 @@ module OutfitsHelper
end end
def render_predicted_missing_species_by_color(species_by_color) def render_predicted_missing_species_by_color(species_by_color)
key_prefix = 'outfits.new.newest_items.unmodeled.content'
# Transform the Color => Array<Species> map into an Array<Pair<Color's # Transform the Color => Array<Species> map into an Array<Pair<Color's
# human name (empty if standard), Array<Species>>>. # human name (empty if standard), Array<Species>>>.
# TODO: i18n
standard = species_by_color.delete(:standard) standard = species_by_color.delete(:standard)
sorted_pairs = species_by_color.to_a.map { |k, v| [k.human_name, v] }. sorted_pairs = species_by_color.to_a.map { |k, v| [k.human_name, v] }.
sort_by { |k, v| k } sort_by { |k, v| k }
@ -66,13 +67,17 @@ module OutfitsHelper
first = true first = true
contents = sorted_pairs.map { |color_human_name, species| contents = sorted_pairs.map { |color_human_name, species|
species_sentence = species.map(&:human_name).sort.to_sentence( species_list = species.map(&:human_name).sort.to_sentence(
two_words_connector: ' or ', last_word_connector: ', or ') words_connector: t("#{key_prefix}.species_list.words_connector"),
content = first ? "Have you seen the #{color_human_name} #{species_sentence} wearing this item?" : "Or maybe the #{color_human_name} #{species_sentence}?" two_words_connector: t("#{key_prefix}.species_list.two_words_connector"),
last_word_connector: t("#{key_prefix}.species_list.last_word_connector"))
key = first ? 'first' : 'other'
content = t("#{key_prefix}.body.#{key}", color: color_human_name,
species_list: species_list)
first = false first = false
content content
} }
contents.last << " If so, please model it above! Thanks!" contents.last << " " + t("#{key_prefix}.call_to_action")
content_tags = contents.map { |c| content_tag(:p, c) } content_tags = contents.map { |c| content_tag(:p, c) }
content_tags.join('').html_safe content_tags.join('').html_safe
end end

View file

@ -647,6 +647,15 @@ en-MEEP:
newest_items: newest_items:
unmodeled: unmodeled:
header: We meep your help! Can you meep these items? header: We meep your help! Can you meep these items?
content:
body:
first: Have you meeped the %{color} %{species_list} wearing this item?
other: Or meepy the %{color} %{species_list}?
call_to_action: If so, please meep it above! Meep!
species_list:
words_connector: '! '
two_words_connector: ' meep '
last_word_connector: '! meep '
modeled: modeled:
header: These items have already been meeped—meep for your help! header: These items have already been meeped—meep for your help!
pet_query: pet_query:

View file

@ -703,6 +703,15 @@ en:
newest_items: newest_items:
unmodeled: unmodeled:
header: We need your help! Can you model these items? header: We need your help! Can you model these items?
content:
body:
first: Have you seen the %{color} %{species_list} wearing this item?
other: Or maybe the %{color} %{species_list}?
call_to_action: If so, please model it above! Thanks!
species_list:
words_connector: ', '
two_words_connector: ' or '
last_word_connector: ', or '
modeled: modeled:
header: These items have already been modeled—thanks for your help! header: These items have already been modeled—thanks for your help!
pet_query: pet_query: