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: docs/building-features/i18n.md
+14-8Lines changed: 14 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,15 +21,26 @@ You can use [Rails internationalization (i18n)](https://guides.rubyonrails.org/i
21
21
22
22
3. The locale files must be generated before `yarn build` using `rake react_on_rails:locale`.
23
23
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
+
24
37
**Recommended: Use Shakapacker's precompile_hook with bin/dev** (React on Rails 16.2+, Shakapacker 9.3+)
25
38
26
-
The locale generation task is idempotent and can be safely called multiple times, automatically skipping generation if files are already up-to-date. Configure it in Shakapacker's `precompile_hook` and `bin/dev` will handle coordination automatically:
39
+
Configure the idempotent task in `config/shakapacker.yml` to run automatically before webpack:
27
40
28
41
```yaml
29
42
# config/shakapacker.yml
30
43
default: &default
31
-
# Run locale generation before webpack compilation
32
-
# Safe to run multiple times - will skip if already built
@@ -41,11 +52,6 @@ You can use [Rails internationalization (i18n)](https://guides.rubyonrails.org/i
41
52
42
53
This eliminates the need for sleep hacks and manual coordination in `Procfile.dev`. See the [Process Managers documentation](./process-managers.md#precompile-hook-integration) for details.
0 commit comments