GithubHelp home page GithubHelp logo

sauy7 / asset_pipeline_i18n Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simplificator/asset_pipeline_i18n

0.0 1.0 0.0 68 KB

If you would like to internationalize your javascript/css files the same way you do in the rest of application... then this is for you.

License: MIT License

asset_pipeline_i18n's Introduction

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: github.com/simplificator/asset_pipeline_i18n

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.