Skip to content

Commit bf6d471

Browse files
committed
Add script to merge and normalize i18n files
1 parent 1e59d53 commit bf6d471

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scripts/refresh-i18n.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# "Refresh" all i18n language files by merging missing keys in lang files
4+
# from a base language file. In addition, sort all files by keys.
5+
6+
BASE_DIR=$(dirname "$0")"/../i18n" # Exclude the trailing slash.
7+
BASE_FILE="en.json"
8+
9+
# Iterate through all i18n files and merge them into the base file,
10+
# filling in missing keys.
11+
for fpath in "$BASE_DIR/"*.json; do
12+
echo $(basename -- $fpath)
13+
echo "$( jq -s '.[0] * .[1]' -S --indent 4 "$BASE_DIR/$BASE_FILE" $fpath )" > $fpath
14+
done

0 commit comments

Comments
 (0)