README.md in i18n-js-3.0.0.rc13 vs README.md in i18n-js-3.0.0.rc14
- old
+ new
@@ -63,27 +63,27 @@
<%= javascript_include_tag "translations" %>
```
**There are two ways to get `translations.js`.**
-1. This `translations.js` file can be automatically generated by the `I18n::JS::Middleware`.
- Just add `config.middleware.use I18n::JS::Middleware` to your `config/application.rb` file.
+1. This `translations.js` file can be automatically generated by the `I18n::JS::Middleware`.
+ Just add `config.middleware.use I18n::JS::Middleware` to your `config/application.rb` file.
2. If you can't or prefer not to generate this file,
you can move the middleware line to your `config/environments/development.rb` file
and run `rake i18n:js:export` before deploying.
This will export all translation files, including the custom scopes
- you may have defined on `config/i18n-js.yml`.
+ you may have defined on `config/i18n-js.yml`.
If `I18n.available_locales` is set (e.g. in your Rails `config/application.rb` file)
- then only the specified locales will be exported.
+ then only the specified locales will be exported.
Current version of `i18n.js` will also be exported to avoid version mismatching by downloading.
#### Export Configuration (For translations)
-Exported translation files generated by `I18n::JS::Middleware` or `rake i18n:js:export` can be customized with config file `config/i18n-js.yml`
-(use `rails generate i18n:js:config` to create it).
-You can even get more files generated to different folders and with different translations to best suit your needs.
-The config file also affects developers using Asset Pipeline to require translations.
+Exported translation files generated by `I18n::JS::Middleware` or `rake i18n:js:export` can be customized with config file `config/i18n-js.yml`
+(use `rails generate i18n:js:config` to create it).
+You can even get more files generated to different folders and with different translations to best suit your needs.
+The config file also affects developers using Asset Pipeline to require translations.
Except the option `file`, since all translations are required by adding `//= require i18n/translations`.
Examples:
```yaml
translations:
@@ -132,18 +132,18 @@
#### Export Configuration (For other things)
- `I18n::JS.config_file_path`
- Expected Type: `String`
- Default: `config/i18n-js.yml`
- Behaviour: Try to read the config file from that location
+ Expected Type: `String`
+ Default: `config/i18n-js.yml`
+ Behaviour: Try to read the config file from that location
- `I18n::JS.export_i18n_js_dir_path`
- Expected Type: `String`
- Default: `public/javascripts`
- Behaviour:
+ Expected Type: `String`
+ Default: `public/javascripts`
+ Behaviour:
- Any `String`: considered as a relative path for a folder to `Rails.root` and export `i18n.js` to that folder for `rake i18n:js:export`
- Any non-`String` (`nil`, `false`, `:none`, etc): Disable `i18n.js` exporting
- `I18n::JS.sort_translation_keys`
Expected Type: `Boolean`
@@ -167,11 +167,11 @@
To find more examples on how to use the configuration file please refer to the tests.
#### Fallbacks
-If you specify the `fallbacks` option, you will be able to fill missing translations with those inside fallback locale(s).
+If you specify the `fallbacks` option, you will be able to fill missing translations with those inside fallback locale(s).
Default value is `true`.
Examples:
```yaml
fallbacks: true
@@ -254,14 +254,14 @@
- file: "public/javascripts/i18n/translations.js"
pretty_print: true
```
-#### Javscript Merge (:js_extend option)
+#### Javscript Deep Merge (:js_extend option)
By default, the output file Javascript will call the `I18n.extend` method to ensure that newly loaded locale
-files are shallow-merged with any locale data already in memory. To disable this either globally or per-file,
+files are deep-merged with any locale data already in memory. To disable this either globally or per-file,
set the `js_extend` option to false
```yaml
js_extend: false # this will disable Javascript I18n.extend globally
translations:
@@ -615,11 +615,11 @@
translations:
+ file: "app/assets/javascript/nls/welcome.js"
only:
+ '*.welcome.*'
-
+
+ file: "app/assets/javascript/nls/albums.js"
only:
+ '*.albums.*'
+ file: "app/assets/javascript/nls/global.js"
@@ -685,17 +685,17 @@
nls/global:
deps:
+ i18n
- # Finally in your modules
+ # Finally in your modules
modules:
+ name: 'application'
include:
+ i18n
+ 'nls/global'
-
+
+ name: 'welcome'
exclude:
+ application
include:
+ 'nls/welcome'
@@ -765,10 +765,10 @@
```
$ rake assets:precompile
```
or similar commands. If you are precompiling assets on the target machine(s), cached pages may be broken by this, so they will need to be refreshed.
-
+
2. You can change something in a different locale file.
3. Finally, you can change `config.assets.version`.
**Note:** See issue [#213](https://github.com/fnando/i18n-js/issues/213) for more details and discussion of this issue.