github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

yannlugrin / globalize

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 44
    • 10
  • Source
  • Commits
  • Network (10)
  • Issues (0)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (13)
    • activesupport_patched
    • db_localize
    • fancy-find
    • for-1.0
    • for-1.1
    • for-1.2
    • for-2.0
    • josh
    • master ✓
    • rails_edge_patched
    • saimon
    • with-mlr
    • without-mlr
  • Tags (1)
    • release-0.1
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Globalize is a Ruby on Rails plugin designed to support multilingual applications (official repository). — Read more

  cancel

http://www.globalize-rails.org

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

tests pass with Rails 2.0.2 (change yours views extenstion, exemple: 
*.html.en.erb or *.xml.en.builder) 
yannlugrin (author)
Mon Dec 17 08:38:44 -0800 2007
commit  5ef08e8fc190c49a73a0eb246255b454a8a0f56b
tree    484648391ddb654603bbe340c0d9fac31450296d
parent  df8aec5e4ccddb9f5cbee41f0c83d9c131fb93dd
globalize /
name age
history
message
file LICENSE Fri Oct 13 07:27:49 -0700 2006 import from old svn hosting (revision 200) [yannlugrin]
file README Mon Mar 12 04:16:54 -0700 2007 --Backporting for-1.2 features [saimonmoore]
directory data/ Sun Apr 29 10:53:40 -0700 2007 added German built-in translations, closes #157... [jsierles]
directory generators/ Fri Apr 27 02:19:41 -0700 2007 --Adding Ole Begemann's <ole@oleb.net> patch to... [saimonmoore]
file init.rb Tue Mar 13 02:42:38 -0700 2007 --Adding Globalize::SupportedLocales class whic... [saimonmoore]
file install.rb Loading commit data...
directory lib/ Mon Dec 17 08:38:44 -0800 2007 tests pass with Rails 2.0.2 (change yours views... [yannlugrin]
directory populators/ Fri Oct 13 07:27:49 -0700 2006 import from old svn hosting (revision 200) [yannlugrin]
directory tasks/ Fri Apr 27 02:22:15 -0700 2007 --Adding fix by Ole Begemann <ole@oleb.net> to ... [saimonmoore]
directory test/ Mon Dec 17 08:38:44 -0800 2007 tests pass with Rails 2.0.2 (change yours views... [yannlugrin]
README
=Welcome to Globalize

*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.

== How to use it

Decide where you'd like globalize to store your translations.

By default globalize stores translations externally in a dedicated table but now
you also have the option to store translations within the model's own table.

To set this method as the default for add:

 Globalize::DbTranslate.keep_translations_in_model = true

to your environment.rb.

=== In your models

  #All translations stored in a separate table
  class Product < ActiveRecord::Base
    translates :name, :description, :specs
  end

or you can override the global setting per model by:

  #All translations stored 'products' table
  class Product < ActiveRecord::Base

    self.keep_translations_in_model = true

    translates
    :name, :description, :specs
  end

Then:

Using <i>keep_translations_in_model = false</i>:

  Locale.set("en-US")
  prod = Product.find(1)

<tt>prod.name -> "Meatballs"</tt>

  Locale.set("es-ES")
  prod = Product.find(1) #Note: A reload of the model instance is required after a locale change.

<tt>prod.name -> "Albondigas"</tt>


Using <i>keep_translations_in_model = true</i>:

  Locale.set("en-US")
  prod = Product.find(1)

<tt>prod.name -> "Meatballs"</tt>

  Locale.set("es-ES")

<tt>prod.name -> "Albondigas"</tt> #Note: No reload of model is required

=== In your views (or anywhere else)

  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"

See the wiki (http://www.globalize-rails.org/) for more documentation.

== How to install

From your rails app root directory:

1. <tt>script/plugin install http://svn.globalize-rails.org/svn/globalize/trunk</tt>
2. <tt>rake globalize:setup</tt> (might take a while, about a minute or so)

...and you're globalized, dude!

Optionally, try:

* <tt>rake test_plugins</tt>
* <tt>rake plugindoc</tt>
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server