mirror of
https://gitlab.com/keys.openpgp.org/hagrid.git
synced 2025-10-05 16:12:44 +02:00
Documentation: https://linux.die.net/man/1/zshoptions -e Exit on non-zero return code from commands -u NO_UNSET -o pipefail propagates piping errors
27 lines
756 B
Bash
Executable File
27 lines
756 B
Bash
Executable File
#!/usr/bin/env -S zsh -euo pipefail
|
|
|
|
for i in templates-untranslated/**/*.hbs; do
|
|
local template=${${i#templates-untranslated/}}
|
|
local prefix_file=${i:h}/template-prefix
|
|
local suffix_file=${i:h}/template-suffix
|
|
|
|
echo -n "$template: "
|
|
|
|
echo -n "en "
|
|
local dist_path=dist/templates/$template
|
|
cat $prefix_file $i $suffix_file >! $dist_path
|
|
|
|
for translated in templates-translated/*/$template(N); do
|
|
local locale=${${translated#templates-translated/}%%/*}
|
|
local dist_path=dist/templates/localized/$locale/$template
|
|
if [[ ! -d ${dist_path:h} ]]; then
|
|
mkdir -p ${dist_path:h}
|
|
fi
|
|
echo -n "$locale "
|
|
# echo "cat $prefix_file $translated $suffix_file >! $dist_path"
|
|
cat $prefix_file $translated $suffix_file >! $dist_path
|
|
done
|
|
echo
|
|
|
|
done
|