I18N Helper plugin

Plugin details

Makes the default Rails helpers i18n compatible

Websitehttp://github.com/iain/i18n_helper Repositorygit://github.com/iain/i18n_helper.git Author Iain Hecker Tags i18n LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install git://github.com/iain/i18n_helper.git

Usage
=============

in app/views/posts/index.html.erb:

<%= link_to(:new_post, new_post_path) %>


This will be the same as:

<%= link_to(t(:new_post), new_post_path) %>


If the argument is not a symbol, it won’t call t(). In the past this would call some interesting view_translate method, which did some scoping. I moved that part (and improved it) to the Mr. T plugin. Please install that to get all kinds of wonderfull goodies for translating from views.

Translating existing helpers
====================================

To translate helper methods of plugins or your own helpers, you can place a yaml file i18n_helper.yml in your config directory. The format is like this:

link_to: 0 content_tag: 1



The number after the method name is the index of the argument to be translated.
This is usually 0, but can of course vary. You can specify an array of indexes if you want.

You can also translate a helper on the spot in code:

I18nHelper.translate_helper(:my_helper, 1, self)


The self is the object on which the helper can be found.

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | Back in time (2 older versions) | Last edited by: scott, 9 months ago