Skip to content

Instantly share code, notes, and snippets.

@giedriusr
Created July 14, 2017 07:20
Show Gist options
  • Save giedriusr/650ec9d6dbe57faf53c5cd470e0ff1ee to your computer and use it in GitHub Desktop.
Save giedriusr/650ec9d6dbe57faf53c5cd470e0ff1ee to your computer and use it in GitHub Desktop.
Issue
# My Setup
### Gemfile
gem 'react-rails'
gem 'i18n-js'
### app/assets/javascripts/application.js
//= require react
//= require react_ujs
//= require i18n
//= require i18n/translations
//= require components
### app/assets/javascripts/components/EventBook.jsx
const text = this.props.is_logged_in ? I18n.t('js_translation') : 'Register and Book';
### app/views/layouts/frontend.html.slim
= javascript_tag do
I18n.defaultLocale = "#{I18n.locale}";
I18n.locale = "#{I18n.locale}";
### config/locales/en.yml
js_translation: "Book EN"
### config/locales/lt.yml
js_translation: "Book LT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment