funquail/front/scripts/i18n-populate-contextualized-strings.sh
Kasper Seweryn 2b40707f4f Cleanup a lot of stuff
I've replaced `lodash` with `lodash-es`, so it can be tree-shaken

`~/modules` is a directory with application modules that run before app is mounted. Useful for configuration, web socket connection, and other stuff

`~/composables` is a directory with our custom composables. Much like `~/utils` but each util is in its own file
2022-09-06 09:26:36 +00:00

23 lines
710 B
Bash
Executable file

#!/usr/bin/env -S bash -eux
# Typical use:
# cp -r locales old_locales
# ./scripts/i18n-extract.sh
# ./scripts/i18n-populate-contextualized-strings.sh old_locales locales
# Then review/commit the changes
cd "$(dirname $0)/.." # change into base directory
old_locales_dir=$1
new_locales_dir=$2
locales=$(tail -n +3 src/locales.ts | sed -E 's/^[^[]+\[] =//' | jq -r '.[].code')
# Generate .po files for each available language.
echo $locales
for lang in $locales; do
echo "Fixing contexts for $lang"
old_po_file=$old_locales_dir/$lang/LC_MESSAGES/app.po
new_po_file=$new_locales_dir/$lang/LC_MESSAGES/app.po
python3 ./scripts/contextualize.py $old_po_file $new_po_file --no-dry-run
done;