i18n for items#index (and layouts#items)

This commit is contained in:
Emi Matchu 2012-12-30 02:40:30 -05:00
parent 34d919179a
commit 5e89e2b947
6 changed files with 103 additions and 35 deletions

View file

@ -34,7 +34,7 @@ class ItemsController < ApplicationController
else else
respond_to do |format| respond_to do |format|
format.html { format.html {
unless fragment_exist?('items#index newest_items') unless localized_fragment_exist?('items#index newest_items')
@newest_items = Item.newest.limit(18) @newest_items = Item.newest.limit(18)
end end
} }

View file

@ -26,6 +26,6 @@ class ItemObserver < ActionController::Caching::Sweeper
def expire_newest_items def expire_newest_items
expire_fragment_in_all_locales('outfits#new newest_items') expire_fragment_in_all_locales('outfits#new newest_items')
expire_fragment('items#index newest_items') expire_fragment_in_all_locales('items#index newest_items')
end end
end end

View file

@ -1,48 +1,42 @@
- if @items - if @items
- title "Searching Infinite Closet for \"#{@query}\"" - title t('.title_with_query', :query => @query)
- if @items.empty? - if @items.empty?
:markdown %p= t '.no_results_html', :query_html => content_tag(:strong, @query)
We couldn't find any wearables that matched **#{h @query}**. Sorry! %p= t '.modeling_request_html',
:modeling_link => link_to(t('.modeling_link_content'), root_path)
Are we missing something? To add an item to our database, just
[show us a pet who is wearing it][1]. That's it!
[1]: /
- else - else
= will_paginate @items = will_paginate @items
= render @items = render @items
= will_paginate @items = will_paginate @items
- else - else
#search-info #search-info
- cache :action_suffix => 'search_help' do - localized_cache :action_suffix => 'search_help' do
#search-help #search-help
%h2 Find what you're looking for %h2= t '.search_help_header'
%dl %dl
%dt kreludor "altador cup" -background %dt= t '.basic_example_query'
%dd= t '.basic_example_description'
%dt= t '.user_items_example_query'
%dd %dd
returns any item with the word "kreludor" and the phrase "altador cup" = t '.user_items_example_description_html',
in it, but not the word "background" :user_items_link => link_to(t('.user_items_example_link_content'),
%dt hat user:owns your_items_path)
%dd %dt= t '.nc_example_query'
returns %dd= t '.nc_example_description'
= link_to 'items that you own', your_items_path %dt= t '.pb_example_query'
with the word "hat" %dd= t '.pb_example_description'
%dt blue is:nc %dt= t '.species_example_query'
%dd returns any NC Mall item with the word "blue" in it %dd= t '.species_example_description'
%dt collar -is:pb %dt= t '.type_example_query'
%dd returns any item with the word "collar" in it that isn't from a paint brush %dd= t '.type_example_description'
%dt species:shoyru
%dd returns any item a Shoyru can wear
%dt type:hat
%dd returns any item that fills a "hat" zone
- cache 'items#index newest_items' do - localized_cache 'items#index newest_items' do
#search-new-items #search-new-items
%h2 Newest items %h2= t '.newest_items_header'
= render @newest_items = render @newest_items
- cache :action_suffix => 'species_search_links' do - localized_cache :action_suffix => 'species_search_links' do
#species-search-links #species-search-links
%h2 Can't decide? Search by species %h2= t '.species_search_header'
= standard_species_search_links = standard_species_search_links

View file

@ -1,15 +1,15 @@
- content_for :before_title, campaign_progress - content_for :before_title, campaign_progress
- content_for :title_category do - content_for :title_category do
Infinite Closet: Neopets customization clothing and wearables database #{t 'infinite_closet'}: #{t '.title_tagline'}
- content_for :before_flashes do - content_for :before_flashes do
%h1 %h1
= link_to items_path do = link_to items_path do
= image_tag 'http://images.neopets.com/items/mall_floatingneggfaerie.gif' = image_tag 'http://images.neopets.com/items/mall_floatingneggfaerie.gif'
%span Infinite Closet %span= t 'infinite_closet'
- content_for :content do - content_for :content do
= form_tag items_path, :method => :get do = form_tag items_path, :method => :get do
= text_field_tag :q, @query = text_field_tag :q, @query
= submit_tag 'Search', :name => nil = submit_tag t('.search'), :name => nil
= yield = yield
= render :file => 'layouts/application' = render :file => 'layouts/application'

View file

@ -29,6 +29,10 @@ en-meep:
copyright: copyright:
Images © 2000%{year} Neopets, Inc. All Rights Reserved. Images © 2000%{year} Neopets, Inc. All Rights Reserved.
Used With Permission. Meep. Used With Permission. Meep.
items:
title_tagline: Neopets customization meep and meepits database
search: Meep
broken_image_reports: broken_image_reports:
new: new:
@ -43,6 +47,39 @@ en-meep:
submit: Meep as broken submit: Meep as broken
converted_at_html: Conveeped %{converted_at_ago} ago converted_at_html: Conveeped %{converted_at_ago} ago
reported_at_html: Repeeped %{reported_at_ago} ago reported_at_html: Repeeped %{reported_at_ago} ago
items:
index:
title_with_query: Searching Infinite Meepit for "%{query}"
no_results_html:
We couldn't meep any wearables that meeped %{query_html}.
Meep!
modeling_request_html:
Are we meeping something? To meep an item to our database, just
%{modeling_link}, and we'll meep our database instantly. Meep!
modeling_link_content: meep us a pet who is meeping it
search_help_header: Find what you're meeping for
basic_example_query: kreludor "altador cup" -background
basic_example_description:
returns any item with the meep "kreludor" and the meep "altador cup"
in it, but not the meep "background"
user_items_example_query: hat user:owns
user_items_example_description_html:
returns %{user_items_link} with the meep "hat"
user_items_example_link_content: items that you meep
nc_example_query: blue is:nc
nc_example_description:
returns any NC Meep item with the meep "blue" in it
pb_example_query: collar -is:pb
pb_example_description:
returns any item with the meep "collar" in it that isn't from a paint
brush
species_example_query: species:shoyru
species_example_description: returns any item a Shoyru can meep
type_example_query: type:hat
type_example_description: returns any item that fills a "hat" meep
newest_items_header: New Meeps
species_search_header: Can't decide? Meep by species
outfits: outfits:
new: new:

View file

@ -29,6 +29,10 @@ en:
copyright: copyright:
Images © 2000%{year} Neopets, Inc. All Rights Reserved. Images © 2000%{year} Neopets, Inc. All Rights Reserved.
Used With Permission Used With Permission
items:
title_tagline: Neopets customization clothing and wearables database
search: Search
broken_image_reports: broken_image_reports:
new: new:
@ -45,6 +49,39 @@ en:
converted_at_html: Converted %{converted_at_ago} ago converted_at_html: Converted %{converted_at_ago} ago
reported_at_html: Reported %{reported_at_ago} ago reported_at_html: Reported %{reported_at_ago} ago
items:
index:
title_with_query: Searching Infinite Closet for "%{query}"
no_results_html:
We couldn't find any wearables that matched %{query_html}.
Sorry!
modeling_request_html:
Are we missing something? To add an item to our database, just
%{modeling_link}, and we'll update our database instantly. Thanks!
modeling_link_content: show us a pet who is wearing it
search_help_header: Find what you're looking for
basic_example_query: kreludor "altador cup" -background
basic_example_description:
returns any item with the word "kreludor" and the phrase "altador cup"
in it, but not the word "background"
user_items_example_query: hat user:owns
user_items_example_description_html:
returns %{user_items_link} with the word "hat"
user_items_example_link_content: items that you own
nc_example_query: blue is:nc
nc_example_description:
returns any NC Mall item with the word "blue" in it
pb_example_query: collar -is:pb
pb_example_description:
returns any item with the word "collar" in it that isn't from a paint
brush
species_example_query: species:shoyru
species_example_description: returns any item a Shoyru can wear
type_example_query: type:hat
type_example_description: returns any item that fills a "hat" zone
newest_items_header: Newest items
species_search_header: Can't decide? Search by species
outfits: outfits:
new: new:
tagline: Neopets wearables made easy! tagline: Neopets wearables made easy!