| Path: | vendor/plugins/globalize/README |
| Last Update: | Tue Jan 24 21:14:57 Jerusalem Standard Time 2006 |
Globalize is a Ruby on Rails plugin designed to support globalized applications. It supports translation into multiple languages (for both db content and controller and view code) and localization of time, data, and numbers. It’s under the MIT License, same as Ruby on Rails.
class Product < ActiveRecord::Base
translates :name, :description, :specs
end
Then:
Locale.set("en-US")
prod = Product.find(1)
prod.name -> "Meatballs"
Locale.set("es-ES")
prod = Product.find(1)
prod.name -> "Albondigas"
Locale.set("he-IL")
<%= "Thanks for ordering!".t %> -> "תודה על ההזמנה!"
<%= "You've got %d items in your cart" / 5 %> -> "יש 5 מוצרים בסל שלך"
Locale.set("es-ES")
<%= Time.now.loc("%d %B %Y") %> -> "17 Octubre 2005"
<%= 12345.45.loc %> -> "12.345,45"
There’s more, but let’s save that for later.
From your rails app root directory:
…and you’re globalized, dude!
Optionally, try: