-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to merge and normalize i18n files
- Loading branch information
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# "Refresh" all i18n language files by merging missing keys in lang files | ||
# from a base language file. In addition, sort all files by keys. | ||
|
||
BASE_DIR=$(dirname "$0")"/../i18n" # Exclude the trailing slash. | ||
BASE_FILE="en.json" | ||
|
||
# Iterate through all i18n files and merge them into the base file, | ||
# filling in missing keys. | ||
for fpath in "$BASE_DIR/"*.json; do | ||
echo $(basename -- $fpath) | ||
echo "$( jq -s '.[0] * .[1]' -S --indent 4 "$BASE_DIR/$BASE_FILE" $fpath )" > $fpath | ||
done |