Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonYCHuang committed Feb 27, 2017
1 parent 1867d74 commit 4537752
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
## [Unreleased]
*Please add entries here for your pull requests.*

### Added
- Allow using rake task to generate javascript locale files. [#717](https://github.com/shakacode/react_on_rails/pull/717) by [JasonYCHuang](https://github.com/JasonYCHuang).

## [6.6.0] - 2017-02-18
### Added
- Switched to yarn! [#715](https://github.com/shakacode/react_on_rails/pull/715) by [squadette](https://github.com/squadette).
Expand Down
18 changes: 8 additions & 10 deletions docs/basics/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,15 @@ You can refer to [react-webpack-rails-tutorial](https://github.com/shakacode/rea
config.i18n_dir = Rails.root.join("PATH_TO", "YOUR_JS_I18N_FOLDER")
```
Add following lines to `config/application.rb`, this will help you to generate `translations.js` & `default.js` automatically when you starts the server.
4. Javascript locale files must be generated before `npm build`.
For __production__ and __test__, once you setup `config.i18n_dir` as in the previous step, react_on_rails will help you to do this.
```js
module YourModule
class Application < Rails::Application
...
config.after_initialize do
ReactOnRails::LocalesToJs.new
end
end
end
For __dev__ , add `bundle exec rake react_on_rails:locale` to `Procfile.dev` before `npm build`.
```ruby
client: sh -c 'rm app/assets/webpack/* || true && bundle exec rake react_on_rails:locale && cd client && npm run build:development'
```
5. In React, you need to initialize `react-intl`, and set parameters for it.
Expand Down

0 comments on commit 4537752

Please sign in to comment.