Agile Web Development with Rails, Edition 4

Agile Web Development with Rails, Edition 4

15.3 Task I3: Translating Checkout 15.1 Task I1: Selecting the locale

15.2 Task I2: translating the store front

Replace translatable text with calls out to translation functions.

edit app/views/carts/_cart.html.erb
<div class="cart_title"><%= t('.title') %></div>
<table>
  <%= render(cart.line_items) %>
 
  <tr class="total_line">
    <td colspan="2">Total</td>
    <td class="total_cell"><%= number_to_currency(cart.total_price) %></td>
  </tr>
 
</table>
<%= button_to t('.checkout'), new_order_url, :method=>:get %>
<%= button_to t('.empty'), cart, :method => :delete,
    :confirm => 'Are you sure?' %>

Define some translations for the cart.

edit config/locales/en.yml
en:
 
  carts:
    cart:
      title:       "Your Cart"
      empty:       "Empty cart"
      checkout:    "Checkout"
edit config/locales/es.yml
es:
 
  carts:
    cart:
      title:       "Carrito de la Compra"
      empty:       "Vaciar Carrito"
      checkout:    "Comprar"

Add to Cart

get /es
Inicio
Preguntas
Noticias
Contacto

Orders
Products
Users

Su Catálogo de Pragmatic

Debug

Debug It!

Professional programmers develop a knack of unerringly zeroing in on the root cause of a bug. They can do that because they've written a lot of buggy code and then gained experience fixing it. This book captures all this experience -- use it, and you'll find you write fewer bugs, and the ones you do write will become easier to hunt down.

34,95 $US
Ruby

Programming Ruby 1.9

Ruby is the fastest growing and most exciting dynamic language out there. If you need to get working programs delivered fast, you should add Ruby to your toolbox.

49,50 $US
Wd4d

Web Design for Developers

Web Design for Developers will show you how to make your web-based application look professionally designed. We'll help you learn how to pick the right colors and fonts, avoid costly interface and accessibility mistakes -- your application will really come alive. We'll also walk you through some common Photoshop and CSS techniques and work through a web site redesign, taking a new design from concept all the way to implementation.

42,95 $US
post /es/line_items?product_id=2
You are being redirected.
get http://localhost:3000/es
Carrito de la Compra
Web Design for Developers 42,95 $US
Total 42,95 $US
Inicio
Preguntas
Noticias
Contacto

Orders
Products
Users

Su Catálogo de Pragmatic

Debug

Debug It!

Professional programmers develop a knack of unerringly zeroing in on the root cause of a bug. They can do that because they've written a lot of buggy code and then gained experience fixing it. This book captures all this experience -- use it, and you'll find you write fewer bugs, and the ones you do write will become easier to hunt down.

34,95 $US
Ruby

Programming Ruby 1.9

Ruby is the fastest growing and most exciting dynamic language out there. If you need to get working programs delivered fast, you should add Ruby to your toolbox.

49,50 $US
Wd4d

Web Design for Developers

Web Design for Developers will show you how to make your web-based application look professionally designed. We'll help you learn how to pick the right colors and fonts, avoid costly interface and accessibility mistakes -- your application will really come alive. We'll also walk you through some common Photoshop and CSS techniques and work through a web site redesign, taking a new design from concept all the way to implementation.

42,95 $US

15.3 Task I3: Translating Checkout 15.1 Task I1: Selecting the locale