opf/openproject — pull request #2 by schmidt (2012-12-12 10:20:09+00:00)
Title: Add i18n-js to OpenProject

# Why client side I18n?

Client-side I18n is needed in a multitude of cases. At the moment, the two UI widgets in OpenProject, Calendar and Wiki Toolbar, use two separate I18n solutions. Every plugin, that is trying to do client side i18n will need to ship a third, fourth and fifth solution.

By introducing i18n-js into the OpenProject core, we can provide a single solution for future enhancements of the core and a generic solution for plugin authors.

# Why i18n-js?

* The plugin seems to be rather popular (Starred: > 500, Forked: > 100 atm).
* It claims to support Rails 3 (not tested by me).
* Its working principals are simple enough to take over development or replace it with something else, if need be.

This pull request is based on #[52](https://github.com/finnlabs/chiliproject/pull/52) in the finnlabs/chiliproject repository.

# Impact on existing users

The install guide needs to be changed. The `public/javascripts/i18n` directory needs to writable, just like the `public/plugin_assets`.

# Usage

I18n keys in the `js` scope will be available on the client side.

en:
js:
hello: Hello, World!

Especially for plugin authors, also js scopes in deeper nestings will be available

en:
my_plugin:
js:
hello: Hello from plugin!

In your JS code, use the following commands:

I18n.t('js.hello'); // => "Hello, World!"
I18n.t('js.my_plugin.hello'); // => "Hello from plugin!"