0.0
No commit activity in last 3 years
No release in over 3 years
Ever wanted to use rails localization helpers inside your assets? Your dream just came true!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
>= 0

Runtime

~> 3.2.18
~> 2.2.2
 Project Readme

I18n assets

Ever wanted to use rails localization helpers inside your assets? Your dream just came true!

Installation

Add this line to your application's Gemfile:

gem 'i18n-assets'

And then execute:

$ bundle

Or install it yourself as:

$ gem install i18n-assets

Usage

Just add .erb extension to your .js and .css files and use standard I18n helpers inside your files.

On assets precompilation localized versions of your files will be generated.

If you need to prevent .js.erb or .css.erb files from caching, you can add config.assets.prevent_caching = true to the environments/development.rb file.

Configuration

By default, i18n-assets localizes all js and css files. That might make your deploys turtle slow. In order to explicitly configure the files you want to localize, simply add config.assets.localize = %w( *.js application.css ) to your environment configuration file.

In case you want to precompile a subset of locales instead all I18n.available_locales ones, you can add config.assets.locales = %w[ en lv ru ] to your environment configuration file.

Example

You can check an example usage here: https://github.com/maximgladkov/localized_assets_precompilation_example_app

Contributing

  1. Fork it ( http://github.com//i18n-assets/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request