Socket
Book a DemoInstallSign in
Socket

internashunalize-js

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

internashunalize-js

0.0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

h2. Intro

This gem takes an other approach to Javascript internationalization than most others do. I use this in production but you might want to look at it as a proof of concept. The goal is to build a lightweight, unobtrusive and powerful translation solution for Frontend applications by using standard libraries.

Right now, you'll have to manually provide the following depencencies: Rails, jQuery and Mustache.

h2. Installation

h3. Add the gem to your Gemfile

bc. gem 'internashunalize-js'

h3. Run the generator

bc. rails g internashunalize:js:install

Don't forget to include the javascript in your Html.

h3. Mark translations you want to use in your scripts

bc. <% t(:yml_key, :javascript => true) %>

h3. Place the view helper somewhere in your layout / views

bc. <%= javascript_translations %>

h2. Usage

Start using the marked translations in your Javascript

bc. I18n.t('yml_key')

For interpolating values, you can pass a Json object as second argument

bc. I18n.t('yml_key_with_variable', { your_variable: 'Variable content' })

FAQs

Package last updated on 14 Mar 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.