Skip to content

Commit df8d156

Browse files
committed
Adjust i18n.md to focus on locale idempotency feature only
Remove references to bin/dev automatic precompile hook coordination, as that feature will be in a separate PR.
1 parent 0ba6556 commit df8d156

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

docs/building-features/i18n.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,29 @@ You can use [Rails internationalization (i18n)](https://guides.rubyonrails.org/i
2121

2222
3. The locale files must be generated before `yarn build` using `rake react_on_rails:locale`.
2323

24+
The locale generation task is idempotent - it will skip generation if files are already up-to-date. This makes it safe to call multiple times without duplicate work:
25+
26+
```bash
27+
bundle exec rake react_on_rails:locale
28+
# Subsequent calls will skip if already up-to-date
29+
```
30+
31+
To force regeneration:
32+
33+
```bash
34+
bundle exec rake react_on_rails:locale force=true
35+
```
36+
2437
**Recommended: Use Shakapacker's precompile_hook** (Shakapacker 9.3+)
2538

26-
The idempotent locale generation task can be safely called multiple times and will skip generation if files are already up-to-date. This makes it ideal for use with Shakapacker's `precompile_hook` feature:
39+
Configure the idempotent task in `config/shakapacker.yml` to run automatically before webpack:
2740

2841
```yaml
2942
# config/shakapacker.yml
3043
default: &default
31-
# Run locale generation before webpack compilation
32-
# Safe to run multiple times - will skip if already built
3344
precompile_hook: 'bundle exec rake react_on_rails:locale'
3445
```
3546
36-
This ensures locale files are always generated before webpack runs, whether in development, production, or CI. To force regeneration:
37-
38-
```bash
39-
bundle exec rake react_on_rails:locale force=true
40-
```
41-
4247
**Alternative: Manual coordination**
4348
4449
For development, you can adjust your startup scripts (`Procfile`s) to run `bundle exec rake react_on_rails:locale` before running any Webpack watch process (`yarn run build:development`).

0 commit comments

Comments
 (0)