Skip to content

Commit

Permalink
Doc fix and return Unreleased placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
danijel committed Mar 29, 2017
1 parent 29d1df5 commit d30ca6b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project's source code will be documented in this fil
Contributors: please follow the recommendations outlined at [keepachangelog.com](http://keepachangelog.com/). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare to the latest release version.

## [Unreleased]
*Please add entries here for your pull requests.*
Add option to specify i18n_yml_dir in order to include only subset of locale files when generating translations.js & default.js for react-intl

## [6.8.2] - 2017-03-24
Expand Down
9 changes: 5 additions & 4 deletions docs/basics/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You can refer to [react-webpack-rails-tutorial](https://github.com/shakacode/rea
```

2. Add `config.i18n_dir` in `config/initializers/react_on_rails.rb`

`react-intl` requires locale files in json format. React on Rails will generate `translations.js` & `default.js` automatically after you configured your `config.i18n_dir` in `config/initializers/react_on_rails.rb`.

```ruby
Expand All @@ -27,16 +27,17 @@ You can refer to [react-webpack-rails-tutorial](https://github.com/shakacode/rea
Optionally you can also set `config.i18n_yml_dir` if you do not what to use all the locale files from rails.
```ruby
# Replace the following line to the location where you keep your client i18n yml files
# By default(without this option), all yaml files from Rails.root.join("config", "locales") and installed gems are loaded
config.i18n_yml_dir = Rails.root.join("PATH_TO", "YOUR_YAML_I18N_FOLDER")
```

`translations.js`: All your locales in json format.
`default.js`: Default settings in json format.

3. Add `translations.js` and `default.js` to your `.gitignore` and `.eslintignore`.
4. Javascript locale files must be generated before `yarn build`.

4. Javascript locale files must be generated before `yarn build`.

Once you setup `config.i18n_dir` as in the previous step, react_on_rails will automatically do this for testing (if using the `ReactOnRails::TestHelper.configure_rspec_to_compile_assets` and for production deployments if using the [default precompile rake hook](../additional-reading/heroku-deployment.md). For development, you should adjust your startup scripts (Procfiles) so that they run `bundle exec rake react_on_rails:locale` before running any webpack watch process (`yarn run build:development`).

5. In React, you need to initialize `react-intl`, and set parameters for it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ReactOnRails.configure do |config|
#
# Replace the following line to the location where you keep your client i18n yml files
# that will source for automatic generation on translations.js & default.js
# By default(without this option) all yaml files from Rails.root.join("config", "locales") and installed gems are loaded
# config.i18n_yml_dir = Rails.root.join("config", "locales", "client")

################################################################################
Expand Down

0 comments on commit d30ca6b

Please sign in to comment.