1
0
mirror of https://github.com/luanti-org/minetest_game.git synced 2025-10-24 13:25:24 +02:00
This commit is contained in:
sfan5
2020-06-14 00:37:16 +02:00
parent d03d7e9bdc
commit fbe62fc84e
3 changed files with 508 additions and 0 deletions

36
updatepo.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash -e
p=$PWD
if ! [[ -f "$p/findtext.lua" && -f "$p/updatetext.lua" ]]; then
echo "Missing findtext.lua and updatetext.lua"
exit 1
fi
luafile=$(mktemp -u).lua
trap 'rm -f $luafile' EXIT
if [ ! -d mods ]; then
echo "Current directory needs to be the repository root"
exit 1
fi
pushd mods
for name in *; do
echo
[ -d "$name/locale" ] || { echo "Skipping $name (no locale folder)"; continue; }
echo "Updating template for $name"
printf 'local S = minetest.get_translator("%s")\n' "$name" >"$luafile"
cat $(find "$name/" -name '*.lua') >>"$luafile"
lua "$p/findtext.lua" -o "$name/locale/template.txt" "$luafile"
echo "Updating translations for $name"
pushd "$name/locale"
for tl in *.tr; do
echo " $tl"
lua "$p/updatetext.lua" template.txt "$tl" >/dev/null
done
popd
done
popd
echo "All done."
exit 0