You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,9 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
6
6
## [Unreleased]
7
7
*Please add entries here for your pull requests.*
8
8
9
+
### Added
10
+
- 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).
11
+
9
12
## [6.6.0] - 2017-02-18
10
13
### Added
11
14
- Switched to yarn! [#715](https://github.com/shakacode/react_on_rails/pull/715) by [squadette](https://github.com/squadette).
Copy file name to clipboardExpand all lines: docs/basics/i18n.md
+5-12Lines changed: 5 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Here's a summary of adding the I18n functionality.
4
4
5
5
You can refer to [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) and [PR #340](https://github.com/shakacode/react-webpack-rails-tutorial/pull/340) for a complete example.
6
6
7
-
1. Add `react-intl` & `intl` to `client/package.json`, and remember to `bundle && npm install`.
7
+
1. Add `react-intl` & `intl` to `client/package.json`, and remember to `bundle && yarn install`.
8
8
9
9
```js
10
10
"dependencies": {
@@ -44,18 +44,11 @@ You can refer to [react-webpack-rails-tutorial](https://github.com/shakacode/rea
Add following lines to `config/application.rb`, this will help you to generate `translations.js` & `default.js` automatically when you starts the server.
47
+
4. Javascript locale files must be generated before `yarn build`.
48
+
49
+
Once you setup `config.i18n_dir` as in the previous step, react_on_rails will help you to do this.
48
50
49
-
```js
50
-
module YourModule
51
-
classApplication< Rails::Application
52
-
...
53
-
config.after_initializedo
54
-
ReactOnRails::LocalesToJs.new
55
-
end
56
-
end
57
-
end
58
-
```
51
+
If you create your own Procfile files, you must add `bundle exec rake react_on_rails:locale` before `yarn build`.
59
52
60
53
5. In React, you need to initialize `react-intl`, and set parameters for it.
0 commit comments