feat: Add scripts for generating and updating translation templates

This commit is contained in:
Andrey Petelin
2025-09-30 13:04:44 +05:00
parent dd44e0156e
commit 014f0f4bdf
2 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -euo pipefail
PODIR="po"
POTFILE="$PODIR/templates/podkop.pot"
if [ $# -ne 1 ]; then
echo "Usage: $0 <language_code> (e.g., ru, de, fr)"
exit 1
fi
LANG="$1"
POFILE="$PODIR/$LANG/podkop.po"
if [ ! -f "$POTFILE" ]; then
echo "Template $POTFILE not found. Run xgettext first."
exit 1
fi
if [ -f "$POFILE" ]; then
echo "Updating $POFILE"
msgmerge --update "$POFILE" "$POTFILE"
else
echo "Creating new $POFILE using msginit"
mkdir -p "$PODIR/$LANG"
msginit --no-translator --locale="$LANG" --input="$POTFILE" --output-file="$POFILE"
fi
echo "Translation file for $LANG updated."