Automatically add language code in masthelp.pot and fix “{singular}” and “{plural}” in en.masthelp.po

This commit is contained in:
pezcurrel 2023-11-02 20:58:56 +01:00
parent b0e2ac7a5a
commit 1be1194b62

View file

@ -17,17 +17,16 @@ cd ../../
if [ $1 == "updpo" ]; then
echo "Aggiorno masthelp.pot con xgettext"
xgettext --no-wrap --from-code utf-8 --add-comments --package-name masthelp --package-version 1.1 --msgid-bugs-address masthelp@insicuri.net web/site/*.php -o web/site/locale/masthelp.pot
xgettext --no-wrap --from-code utf-8 --add-comments --copyright-holder masthelp@insicuri.net --package-name mastodon.help --package-version 1.1 --msgid-bugs-address masthelp@insicuri.net web/site/*.php -o - | sed -e 's/^"Language: \\n"$/"Language: en\\n"/' > web/site/locale/masthelp.pot
echo "Aggiorno masthelp.po per «en» con msgen"
msgen --no-wrap web/site/locale/masthelp.pot -o web/site/locale/en/en_US.UTF-8/LC_MESSAGES/masthelp.po
msgen --no-wrap web/site/locale/masthelp.pot -o - | sed -e 's/msgstr "Not available{singular}"/msgstr "Not available"/' -e 's/msgstr "Not available{plural}"/msgstr "Not available"/' > web/site/locale/en/en_US.UTF-8/LC_MESSAGES/masthelp.po
for lang in ${langs[@]}; do
if [ $lang != "en" ]; then
echo "Aggiorno masthelp.po per «$lang» con msgmerge"
msgmerge --update --no-wrap web/site/locale/$lang/en_US.UTF-8/LC_MESSAGES/masthelp.po web/site/locale/masthelp.pot
fi
done
echo "Fatto! Ora puoi editare i vari masthelp.po. Ricordati di editare anche"
echo "quello per «en» rimuovendo \"{singular}\" e \"{plural}\" ;-)"
echo "Fatto! Ora puoi editare i vari masthelp.po."
elif [ $1 == "updmo" ]; then
for lang in ${langs[@]}; do
echo "Aggiorno masthelp.mo per «$lang»"