Compare commits
2 commits
144e43d164
...
f260da3594
Author | SHA1 | Date | |
---|---|---|---|
f260da3594 | |||
3b93b14e29 |
1 changed files with 16 additions and 6 deletions
22
setup.sh
22
setup.sh
|
@ -883,26 +883,36 @@ cat <<'SCRIPT_END' > ../translate.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# 0.1 Change to the project directory (where docker-compose.yml is located)
|
|
||||||
cd "$(dirname "$0")/steam-gift-manager"
|
cd "$(dirname "$0")/steam-gift-manager"
|
||||||
|
|
||||||
declare -a locales=("de" "en")
|
declare -a locales=("de" "en")
|
||||||
|
|
||||||
# 1. POT-Datei aktualisieren
|
|
||||||
docker-compose run --rm steam-manager pybabel extract -F babel.cfg -o translations/messages.pot .
|
docker-compose run --rm steam-manager pybabel extract -F babel.cfg -o translations/messages.pot .
|
||||||
|
|
||||||
# 2. PO files for each language
|
|
||||||
for lang in "${locales[@]}"; do
|
for lang in "${locales[@]}"; do
|
||||||
|
po_path="translations/${lang}/LC_MESSAGES/messages.po"
|
||||||
|
|
||||||
|
if [ -f "$po_path" ]; then
|
||||||
|
encoding=$(file -i "$po_path" | grep -Po 'charset=\K.+')
|
||||||
|
|
||||||
|
if [[ "$encoding" != "utf-8" ]]; then
|
||||||
|
echo "Konvertiere $po_path von $encoding nach UTF-8"
|
||||||
|
iconv -f "$encoding" -t UTF-8 "$po_path" > "$po_path.utf8"
|
||||||
|
mv "$po_path.utf8" "$po_path"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
docker-compose run --rm steam-manager pybabel update \
|
docker-compose run --rm steam-manager pybabel update \
|
||||||
-i translations/messages.pot \
|
-i translations/messages.pot \
|
||||||
-d translations \
|
-d translations \
|
||||||
-l $lang --previous
|
-l "$lang" \
|
||||||
|
--previous
|
||||||
done
|
done
|
||||||
|
|
||||||
# 3. Compile MO files (without fuzzy entries)
|
|
||||||
docker-compose run --rm steam-manager pybabel compile -d translations
|
docker-compose run --rm steam-manager pybabel compile -d translations
|
||||||
|
|
||||||
echo "✅ Translations successfully updated!"
|
echo "✅ Setup and/or update translations done! YOLO"
|
||||||
|
|
||||||
SCRIPT_END
|
SCRIPT_END
|
||||||
chmod +x ../translate.sh
|
chmod +x ../translate.sh
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue