Writing files triggers other actions in anything watching those files - eg rebuilding a webpack bundle. Normally this won't occur as i18n-js's caching will determine that nothing needs to be done, but it can add up quickly when running individual specs from the command line, where the cache is reset on every load.
How to reproduce
> i18n export
> ls -la app/packs/locales/generated
drwxr-xr-x 4 vscode vscode 4096 Dec 30 16:06 ..
-rw-r--r-- 1 vscode vscode 1532625 Dec 30 16:29 bg.json
-rw-r--r-- 1 vscode vscode 1058584 Dec 30 16:29 cs.json
# ...
# 1 minute later
> i18n export
> ls -la app/packs/locales/generated
drwxr-xr-x 4 vscode vscode 4096 Dec 30 16:06 ..
-rw-r--r-- 1 vscode vscode 1532625 Dec 30 16:30 bg.json
-rw-r--r-- 1 vscode vscode 1058584 Dec 30 16:30 cs.json
# ...
What do you expect
Files should not be rewritten if identical (v3 behavior):
> i18n export
> ls -la app/packs/locales/generated
drwxr-xr-x 4 vscode vscode 4096 Dec 30 16:06 ..
-rw-r--r-- 1 vscode vscode 1532625 Dec 30 16:29 bg.json
-rw-r--r-- 1 vscode vscode 1058584 Dec 30 16:29 cs.json
# ...
# 1 minute later
> i18n export
> ls -la app/packs/locales/generated
drwxr-xr-x 4 vscode vscode 4096 Dec 30 16:06 ..
-rw-r--r-- 1 vscode vscode 1532625 Dec 30 16:29 bg.json
-rw-r--r-- 1 vscode vscode 1058584 Dec 30 16:29 cs.json
# ...
Description
Running
i18n export
should not rewrite exported JSON localization files if the content hasn't changed.In
v3
, it was fixed in https://github.com/fnando/i18n-js/pull/473. https://github.com/fnando/i18n-js/blob/4b07b30e8b6f42c4415f4bb967e8e2986a0e2268/lib/i18n/js.rb#L256Description from original PR https://github.com/fnando/i18n-js/pull/473:
How to reproduce
What do you expect
Files should not be rewritten if identical (
v3
behavior):What happened instead
Files are being rewritten.
Software: