Sha256: 307aa53a2abbb11de75132a53fe41f78f3caa0213237108dae0bd6d5ada267c3

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

= AssetPipelineI18n

Shortly: asset-pipeline + i18n

Some additional words: you would like to internationalize your javascript/css files the same way you do in the rest of application. For example you would like to write something like:

*app/assets/file.js.erb*

  alert(<%= I18n.t('javascript.key.name') %>)

That works OK in development mode but with asset pipeline you have only one precompiled and (cached) *application.js* file translated with the default language.
What you would need is a collection of language specific _application.js_ files, like *application-en.js*, *application-it.js*, etc. This gem is exactly for that!

== Usage

In your Gemfile

  group :assets do
    gem 'asset_pipeline_i18n'
  end

In your application.rb

  config.assets.localized_precompile = ['application-it.js', 'application-fr.js', 'application-de.js', 'application-en.js']

then

  rake assets:precompile i18n:assets:precompile

Of course you also have to use something like:
  javascript_include_tag "application-#{I18n.locale}"

== Versioning

The idea is to use the same version number of the Rails version the gem is compatible with. So asset_pipeline_i18n version 3.2.5 is for Rails 3.2.5 and so on.
If the gem is broken and we have to release a fix, then we will use a forth levelnumber, like 3.2.5.1
To keep things easy, the dependency of the gem if of the form ~> x.x.x, so we assume that it works also with new versions of Rails, until proved otherwise :)

== Contacts

Home page: https://github.com/simplificator/asset_pipeline_i18n

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asset_pipeline_i18n-3.2.8 README.rdoc