2019-09-30 06:53:20 -04:00
|
|
|
#!/bin/zsh
|
|
|
|
|
2019-10-03 12:17:26 -04:00
|
|
|
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
|
2019-09-30 06:53:20 -04:00
|
|
|
|
2019-10-03 12:17:26 -04:00
|
|
|
echo -n "$template: "
|
2019-11-09 06:12:04 -05:00
|
|
|
|
|
|
|
echo -n "en "
|
|
|
|
local dist_path=dist/templates/$template
|
|
|
|
cat $prefix_file $i $suffix_file >! $dist_path
|
|
|
|
|
2019-10-03 12:17:26 -04:00
|
|
|
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
|
2019-09-30 06:53:20 -04:00
|
|
|
|
|
|
|
done
|