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
respond_to do |format|
format.html {
unless fragment_exist?('items#index newest_items')
unless localized_fragment_exist?('items#index newest_items')
@newest_items = Item.newest.limit(18)
end
}

View file

@ -26,6 +26,6 @@ class ItemObserver < ActionController::Caching::Sweeper
def expire_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

View file

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

View file

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

View file

@ -29,6 +29,10 @@ en-meep:
copyright:
Images © 2000%{year} Neopets, Inc. All Rights Reserved.
Used With Permission. Meep.
items:
title_tagline: Neopets customization meep and meepits database
search: Meep
broken_image_reports:
new:
@ -43,6 +47,39 @@ en-meep:
submit: Meep as broken
converted_at_html: Conveeped %{converted_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:
new:

View file

@ -29,6 +29,10 @@ en:
copyright:
Images © 2000%{year} Neopets, Inc. All Rights Reserved.
Used With Permission
items:
title_tagline: Neopets customization clothing and wearables database
search: Search
broken_image_reports:
new:
@ -45,6 +49,39 @@ en:
converted_at_html: Converted %{converted_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:
new:
tagline: Neopets wearables made easy!