README.textile in rich_i18n-1.2.3 vs README.textile in rich_i18n-1.3.0

- old
+ new

@@ -33,54 +33,50 @@ *Note*: keep in mind that you will have to use E9s to do this, please visit "http://github.com/archan937/e9s":http://github.com/archan937/e9s for more information. h2. Installation -h3. Using Rich-i18n as gem +h3. Using Rich-i18n as gem in Rails 3 -Install the Rich-i18n gem: +Add Rich-i18n in @Gemfile@ as a gem dependency: <pre> - sudo gem install rich_i18n + gem "rich_i18n" </pre> -Add rich_i18n in environment.rb as a gem dependency: +Run the following in your console to install with Bundler: <pre> - config.gem "rich_i18n" + bundle install </pre> -h3. Using Rich-i18n as plugin +h3. Using Rich-i18n as gem in Rails 2 -Install the Rich-i18n plugin: +Add Rich-i18n in @environment.rb@ as a gem dependency: <pre> - ./script/plugin install git://github.com/archan937/rich_i18n.git + config.gem "rich_i18n" </pre> -Install i18n if you haven't already: +Run the following in your console: <pre> - sudo gem install i18n + sudo rake gems:install </pre> -h3. Optional +h3. Using Rich-i18n as plugin in Rails 3 -You will have to install the @Formtastic@ plugin when translating @labels@ and @seatholders@ with *Rich-i18n as plugin*: - <pre> - ./script/plugin install git://github.com/justinfrench/formtastic.git + rails plugin install git://github.com/archan937/rich_i18n.git </pre> -When wanting to use @seatholders@, please include @seat_holder.js@ in your template: +h3. Using Rich-i18n as plugin in Rails 2 <pre> - <script src="path/to/seat_holder.js" type="text/javascript"></script> + script/plugin install git://github.com/archan937/rich_i18n.git </pre> -*Note*: please visit "http://github.com/archan937/seat_holder":http://github.com/archan937/seat_holder for more information about SeatHolder. - h3. Testing Rich-i18n out-of-the-box Run the Rails console: <pre> @@ -94,10 +90,42 @@ => :nl >> "Male / Female".t => "Man / Vrouw" </pre> +h2. Use the provided Rails generators + +Rich-i18n requires the following entity: + +* An @ActiveRecord@ model used for translations storage + +Fortunately, Rich-i18n is provided with a Rails generator with which you can generate the entity. + +h4. In Rails 3 + +Run the following in your console: + +<pre> + rails g rich:translation -m +</pre> + +*Note*: At default, it will create the @Translation@ class and @CreateTranslations@ migration. You can alter the class names with the following: + +<pre> + rails g rich:translation CodeHeroes::Translation -m +</pre> + +*Note*: The generator has the @-m@ or @--migrate@ option which runs @rake db:migrate@ after creating the files. + +h4. In Rails 2 + +Run the following in your console: + +<pre> + script/generate rich_i18n_translation -m +</pre> + h2. Usage Just call the @t@ method on string or symbols to translate using Rich-i18n. h3. Populating config/locales @@ -107,11 +135,11 @@ *Note*: specified in @config/locales/nl.yml@ <pre> --- nl: - + word: "yes": ja "no": nee house: huis letter: brief @@ -201,36 +229,36 @@ *Note*: specified in @config/locales/nl.yml@ <pre> --- nl: - + word: password: wachtwoord - + label: user_name: gebruikersnaam content: bericht - + Question: content: jouw vraag - + Answer: content: jouw antwoord - + (search_form) criteria: uw zoekcriteria - + seatholder: email_address: uw.naam@een.website.nl - + Question: content: Hoeveel uren zitten in een dag? - + Answer: content: 24 uur - + (search_form) criteria: '&Voorbeeld' </pre> h2. Contact me @@ -261,10 +289,9 @@ h2. ToDo's * Handle the click on inputs with seatholders better * Use a better implementation to tackle String interpolation (e.g. "foo #{"bar".t}") to preserve meta data * Most String inflection methods are also defined in rich_pluralization (keep it DRY) -* Make Rich-i18n compatible with Rails 3 h2. Enrichments The all-in-one gem at - "http://codehero.es/rails_gems_plugins/e9s":http://codehero.es/rails_gems_plugins/e9s - "http://github.com/archan937/e9s":http://github.com/archan937/e9s