2020-10-15 19:24:45 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-10-27 16:32:23 +01:00
|
|
|
if [ -z $1 ]; then
|
|
|
|
echo "Devi specificare un comando («updpo» per aggiornare il pot e i po, «updmo» per poi aggiornare gli mo)."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ $1 != "updpo" ] && [ $1 != "updmo" ]; then
|
|
|
|
echo "«$1» non è un comando noto; usa «updpo» per aggiornare il pot e i po, «updmo» per poi aggiornare gli mo."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-06-27 16:17:13 +02:00
|
|
|
langs=("ar" "ars" "ca" "cs" "de" "en" "es" "fa" "fr" "gl" "id" "it" "nl" "pl" "pt" "pt_BR" "ru" "tr" "uk")
|
2020-10-15 19:24:45 +02:00
|
|
|
|
2020-10-27 16:32:23 +01:00
|
|
|
basedir=$(dirname "$0")
|
|
|
|
cd "$basedir"
|
2023-01-07 19:30:41 +01:00
|
|
|
cd ../../
|
2020-10-15 19:24:45 +02:00
|
|
|
|
2020-10-27 16:32:23 +01:00
|
|
|
if [ $1 == "updpo" ]; then
|
|
|
|
echo "Aggiorno masthelp.pot con xgettext"
|
2023-12-26 23:41:04 +01:00
|
|
|
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 web/lib/*.php -o - | sed -e 's/^"Language: \\n"$/"Language: en\\n"/' > web/site/locale/masthelp.pot
|
2020-10-27 16:32:23 +01:00
|
|
|
echo "Aggiorno masthelp.po per «en» con msgen"
|
2023-11-02 20:58:56 +01:00
|
|
|
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
|
2020-10-27 16:32:23 +01:00
|
|
|
for lang in ${langs[@]}; do
|
|
|
|
if [ $lang != "en" ]; then
|
|
|
|
echo "Aggiorno masthelp.po per «$lang» con msgmerge"
|
2023-01-07 19:30:41 +01:00
|
|
|
msgmerge --update --no-wrap web/site/locale/$lang/en_US.UTF-8/LC_MESSAGES/masthelp.po web/site/locale/masthelp.pot
|
2020-10-27 16:32:23 +01:00
|
|
|
fi
|
|
|
|
done
|
2023-11-02 20:58:56 +01:00
|
|
|
echo "Fatto! Ora puoi editare i vari masthelp.po."
|
2020-10-27 16:32:23 +01:00
|
|
|
elif [ $1 == "updmo" ]; then
|
|
|
|
for lang in ${langs[@]}; do
|
2020-10-30 19:33:09 +01:00
|
|
|
echo "Aggiorno masthelp.mo per «$lang»"
|
2023-01-07 19:30:41 +01:00
|
|
|
msgfmt web/site/locale/$lang/en_US.UTF-8/LC_MESSAGES/masthelp.po -o web/site/locale/$lang/en_US.UTF-8/LC_MESSAGES/masthelp.mo
|
2020-10-27 16:32:23 +01:00
|
|
|
done
|
|
|
|
echo "Fatto! :-)"
|
|
|
|
else
|
|
|
|
echo "IMPOSSIBILE!"
|
|
|
|
fi
|
2020-10-23 19:00:43 +02:00
|
|
|
|
2020-10-27 16:32:23 +01:00
|
|
|
exit 0
|