2008-04-21 09:34:39 -04:00
|
|
|
# run this script from the root directory to re-generate the .pot file
|
|
|
|
#
|
|
|
|
# ./data/po/update_pot.sh
|
2020-05-31 00:01:47 -04:00
|
|
|
if [ -z "$PYTHON" ]; then
|
|
|
|
PYTHON="python"
|
|
|
|
fi
|
2008-04-21 09:34:39 -04:00
|
|
|
|
2018-09-12 16:53:58 -04:00
|
|
|
CPP_FILE_LIST="`find ./src \
|
|
|
|
-name '*.cpp' -or \
|
|
|
|
-name '*.c' -or \
|
|
|
|
-name '*.hpp' -or \
|
2018-08-21 01:34:27 -04:00
|
|
|
-name "*.h" | sort -n \
|
2014-12-27 16:11:31 -05:00
|
|
|
`"
|
2018-09-12 16:53:58 -04:00
|
|
|
XML_FILE_LIST="`find ./data \
|
|
|
|
../stk-assets/tracks \
|
|
|
|
../stk-assets/karts \
|
|
|
|
../supertuxkart-assets/tracks \
|
|
|
|
../supertuxkart-assets/karts \
|
2020-07-19 02:21:14 -04:00
|
|
|
./android/res/values \
|
2018-09-12 16:53:58 -04:00
|
|
|
-name 'achievements.xml' -or \
|
2019-12-18 00:49:36 -05:00
|
|
|
-name 'tips.xml' -or \
|
2018-09-12 16:53:58 -04:00
|
|
|
-name 'kart.xml' -or \
|
|
|
|
-name 'track.xml' -or \
|
|
|
|
-name 'scene.xml' -or \
|
|
|
|
-name '*.challenge' -or \
|
|
|
|
-name '*.grandprix' -or \
|
2020-07-19 02:21:14 -04:00
|
|
|
-name 'strings.xml' -or \
|
2018-09-12 16:53:58 -04:00
|
|
|
-name '*.stkgui' | sort -n \
|
2014-12-27 16:11:31 -05:00
|
|
|
`"
|
2018-09-12 16:53:58 -04:00
|
|
|
ANGELSCRIPT_FILE_LIST="`find ./data \
|
|
|
|
../stk-assets/tracks \
|
|
|
|
../supertuxkart-assets/tracks \
|
|
|
|
-name '*.as' | sort -n \
|
|
|
|
`"
|
2008-05-09 14:39:48 -04:00
|
|
|
|
|
|
|
echo "--------------------"
|
2008-05-10 10:48:57 -04:00
|
|
|
echo " Source Files :"
|
2008-05-09 14:39:48 -04:00
|
|
|
echo "--------------------"
|
|
|
|
echo $CPP_FILE_LIST
|
2015-04-30 19:03:54 -04:00
|
|
|
echo $ANGELSCRIPT_FILE_LIST
|
2009-08-29 17:16:51 -04:00
|
|
|
|
2008-05-10 10:48:57 -04:00
|
|
|
echo "--------------------"
|
2010-09-01 12:01:19 -04:00
|
|
|
echo " XML Files :"
|
2008-05-10 10:48:57 -04:00
|
|
|
echo "--------------------"
|
2011-01-10 18:04:27 -05:00
|
|
|
echo $XML_FILE_LIST
|
2009-08-29 21:28:46 -04:00
|
|
|
|
|
|
|
# XML Files
|
2020-05-31 00:01:47 -04:00
|
|
|
eval '$PYTHON ./data/po/extract_strings_from_XML.py $XML_FILE_LIST'
|
2009-08-29 17:16:51 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-05-09 14:39:48 -04:00
|
|
|
echo "---------------------------"
|
|
|
|
echo " Generating .pot file..."
|
2009-08-29 17:16:51 -04:00
|
|
|
|
2015-02-08 18:16:08 -05:00
|
|
|
# XML Files
|
2015-05-10 06:09:01 -04:00
|
|
|
xgettext -d supertuxkart --keyword=_ --add-comments="I18N:" \
|
2015-02-08 18:16:08 -05:00
|
|
|
-p ./data/po -o supertuxkart.pot \
|
|
|
|
--no-location --from-code=UTF-8 ./data/po/gui_strings.h \
|
|
|
|
--package-name=supertuxkart
|
|
|
|
|
2009-08-29 17:16:51 -04:00
|
|
|
# C++ Files
|
2015-05-10 06:09:01 -04:00
|
|
|
xgettext -j -d supertuxkart --keyword=_ --keyword=N_ --keyword=_LTR \
|
2015-01-02 15:19:44 -05:00
|
|
|
--keyword=_C:1c,2 --keyword=_P:1,2 \
|
|
|
|
--keyword=_CP:1c,2,3 --add-comments="I18N:" \
|
2014-12-27 16:11:31 -05:00
|
|
|
-p ./data/po -o supertuxkart.pot $CPP_FILE_LIST \
|
|
|
|
--package-name=supertuxkart
|
2009-08-29 17:16:51 -04:00
|
|
|
|
2015-04-30 19:03:54 -04:00
|
|
|
# Angelscript files (xgettext doesn't support AS so pretend it's c++)
|
2015-09-25 04:31:04 -04:00
|
|
|
xgettext -j -d supertuxkart --keyword="translate" --add-comments="I18N:" \
|
2015-04-30 19:03:54 -04:00
|
|
|
-p ./data/po -o supertuxkart.pot $ANGELSCRIPT_FILE_LIST \
|
|
|
|
--package-name=supertuxkart --language=c++
|
2015-02-08 18:16:08 -05:00
|
|
|
|
2020-09-06 12:08:44 -04:00
|
|
|
STK_DESCRIPTION="A 3D open-source kart racing game"
|
2020-09-03 04:43:30 -04:00
|
|
|
STK_DESKTOP_FILE_P1="[Desktop Entry]"
|
|
|
|
# Split it to avoid SuperTuxKart being translated
|
|
|
|
STK_DESKTOP_FILE_P2="Name=SuperTuxKart
|
|
|
|
Icon=supertuxkart"
|
2020-09-04 09:54:02 -04:00
|
|
|
STK_DESKTOP_FILE_P3="#I18N: Generic name in desktop file entry, \
|
|
|
|
summary in AppData and short description in Google Play
|
2020-09-06 12:08:44 -04:00
|
|
|
GenericName=$STK_DESCRIPTION
|
2020-09-03 04:43:30 -04:00
|
|
|
Exec=supertuxkart
|
|
|
|
Terminal=false
|
|
|
|
StartupNotify=false
|
|
|
|
Type=Application
|
|
|
|
Categories=Game;ArcadeGame;
|
|
|
|
#I18N: Keywords in desktop entry, translators please keep it separated with semicolons
|
|
|
|
Keywords=tux;game;race;
|
|
|
|
PrefersNonDefaultGPU=true"
|
|
|
|
|
|
|
|
echo "${STK_DESKTOP_FILE_P1}" > supertuxkart.desktop
|
|
|
|
echo "${STK_DESKTOP_FILE_P3}" >> supertuxkart.desktop
|
|
|
|
|
2020-09-04 09:54:02 -04:00
|
|
|
STK_APPDATA_P1="Karts. Nitro. Action! SuperTuxKart is a 3D open-source arcade racer \
|
|
|
|
with a variety of characters, tracks, and modes to play. \
|
|
|
|
Our aim is to create a game that is more fun than realistic, \
|
|
|
|
and provide an enjoyable experience for all ages."
|
|
|
|
STK_APPDATA_P2="Discover the mystery of an underwater world, \
|
|
|
|
or drive through the jungles of Val Verde and visit the famous Cocoa Temple. \
|
|
|
|
Race underground or in a spaceship, through a rural farmland or a strange alien planet. \
|
|
|
|
Or rest under the palm trees on the beach, watching the other karts overtake you. \
|
|
|
|
But don't eat the bananas! Watch for bowling balls, plungers, bubble gum, \
|
|
|
|
and cakes thrown by your opponents."
|
|
|
|
STK_APPDATA_P3="You can do a single race against other karts, \
|
|
|
|
compete in one of several Grand Prix, \
|
|
|
|
try to beat the high score in time trials on your own, \
|
|
|
|
play battle mode against the computer or your friends, \
|
|
|
|
and more! For a greater challenge, race online against players from all over the world \
|
2020-09-20 21:33:35 -04:00
|
|
|
and prove your racing skills!"
|
2020-09-04 09:54:02 -04:00
|
|
|
# Used in google play only for now
|
|
|
|
STK_APPDATA_P4="This game is free and without ads."
|
2020-09-06 12:45:36 -04:00
|
|
|
# Used in google play beta only for now
|
|
|
|
STK_APPDATA_P5="This is an unstable version of SuperTuxKart that contains latest improvements. \
|
|
|
|
It is released mainly for testing, to make stable STK as good as possible."
|
|
|
|
STK_APPDATA_P6="This version can be installed in parallel with the stable version on the device."
|
|
|
|
STK_APPDATA_P7="If you need more stability, consider using the stable version: %s"
|
|
|
|
STK_STABLE_URL="https://play.google.com/store/apps/details?id=org.supertuxkart.stk"
|
2020-09-04 09:54:02 -04:00
|
|
|
|
|
|
|
STK_APPDATA_FILE_1="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
|
|
|
<component type=\"desktop\">
|
|
|
|
<id>supertuxkart.desktop</id>
|
|
|
|
<metadata_license>CC0-1.0</metadata_license>
|
|
|
|
<project_license>GPL-3.0+</project_license>"
|
|
|
|
# Split it to avoid SuperTuxKart being translated
|
|
|
|
STK_APPDATA_FILE_2=" <name>SuperTuxKart</name>"
|
|
|
|
STK_APPDATA_FILE_3=" <summary>A 3D open-source kart racing game</summary>
|
|
|
|
<description>
|
|
|
|
<p>
|
|
|
|
"${STK_APPDATA_P1}"
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
"${STK_APPDATA_P2}"
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
"${STK_APPDATA_P3}"
|
|
|
|
</p>"
|
|
|
|
STK_APPDATA_FILE_4=" <p>
|
2020-09-06 12:45:36 -04:00
|
|
|
$STK_APPDATA_P4
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
$STK_APPDATA_P5
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
$STK_APPDATA_P6
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
$STK_APPDATA_P7
|
2020-09-04 09:54:02 -04:00
|
|
|
</p>"
|
|
|
|
STK_APPDATA_FILE_5=" </description>
|
|
|
|
<screenshots>
|
|
|
|
<screenshot type=\"default\">
|
|
|
|
<image>https://supertuxkart.net/images/8/83/Supertuxkart-0.9.2-screenshot-3.jpg</image>
|
|
|
|
<caption>Normal Race</caption>
|
|
|
|
</screenshot>
|
|
|
|
<screenshot>
|
|
|
|
<image>https://supertuxkart.net/images/1/1f/Supertuxkart-0.9.2-screenshot-1.jpg</image>
|
|
|
|
<caption>Battle</caption>
|
|
|
|
</screenshot>
|
|
|
|
<screenshot>
|
|
|
|
<image>https://supertuxkart.net/images/2/2a/Supertuxkart-0.9.2-screenshot-2.jpg</image>
|
|
|
|
<caption>Soccer</caption>
|
|
|
|
</screenshot>
|
|
|
|
</screenshots>
|
|
|
|
<developer_name>SuperTuxKart Team</developer_name>
|
|
|
|
<update_contact>supertuxkart-devel@lists.sourceforge.net</update_contact>
|
|
|
|
<url type=\"homepage\">https://supertuxkart.net</url>
|
|
|
|
<url type=\"bugtracker\">https://github.com/supertuxkart/stk-code/issues</url>
|
|
|
|
<url type=\"donation\">https://supertuxkart.net/Donate</url>
|
|
|
|
<url type=\"help\">https://supertuxkart.net/Community</url>
|
|
|
|
<url type=\"translate\">https://supertuxkart.net/Translating_STK</url>
|
|
|
|
<content_rating type=\"oars-1.1\">
|
|
|
|
<content_attribute id=\"violence-cartoon\">mild</content_attribute>
|
|
|
|
<content_attribute id=\"social-chat\">intense</content_attribute>
|
|
|
|
</content_rating>
|
2020-09-07 01:01:48 -04:00
|
|
|
<languages>"
|
|
|
|
STK_APPDATA_FILE_6=" </languages>
|
2020-09-04 09:54:02 -04:00
|
|
|
</component>"
|
|
|
|
|
|
|
|
echo "${STK_APPDATA_FILE_1}" > supertuxkart.appdata.xml
|
|
|
|
echo "${STK_APPDATA_FILE_3}" >> supertuxkart.appdata.xml
|
|
|
|
echo "${STK_APPDATA_FILE_4}" >> supertuxkart.appdata.xml
|
|
|
|
echo "${STK_APPDATA_FILE_5}" >> supertuxkart.appdata.xml
|
2020-09-07 01:01:48 -04:00
|
|
|
echo "${STK_APPDATA_FILE_6}" >> supertuxkart.appdata.xml
|
2020-09-04 09:54:02 -04:00
|
|
|
|
|
|
|
# Desktop and AppData entry
|
2020-09-03 04:43:30 -04:00
|
|
|
xgettext -j -d supertuxkart --add-comments="I18N:" \
|
|
|
|
-p ./data/po -o supertuxkart.pot \
|
2020-09-04 09:54:02 -04:00
|
|
|
--package-name=supertuxkart supertuxkart.desktop supertuxkart.appdata.xml
|
2020-09-03 04:43:30 -04:00
|
|
|
|
|
|
|
echo "${STK_DESKTOP_FILE_P1}" > supertuxkart.desktop
|
|
|
|
echo "${STK_DESKTOP_FILE_P2}" >> supertuxkart.desktop
|
|
|
|
echo "${STK_DESKTOP_FILE_P3}" >> supertuxkart.desktop
|
|
|
|
|
2020-09-04 09:54:02 -04:00
|
|
|
echo "${STK_APPDATA_FILE_1}" > supertuxkart.appdata.xml
|
|
|
|
echo "${STK_APPDATA_FILE_2}" >> supertuxkart.appdata.xml
|
|
|
|
echo "${STK_APPDATA_FILE_3}" >> supertuxkart.appdata.xml
|
|
|
|
# Skip google play message
|
|
|
|
echo "${STK_APPDATA_FILE_5}" >> supertuxkart.appdata.xml
|
|
|
|
|
|
|
|
# Manually copy zh_TW to zh_HK for fallback
|
|
|
|
cp data/po/zh_TW.po data/po/zh_HK.po
|
2020-09-06 12:08:44 -04:00
|
|
|
rm -rf ./google_play_msg
|
|
|
|
|
|
|
|
function translate_str()
|
|
|
|
{
|
|
|
|
# Remove newline in msgid of po file first
|
|
|
|
echo $(sed ':a;N;$!ba;s/\"\n\"//g' "$2" \
|
|
|
|
| grep -A 1 -e "msgid \"$1\"" | sed -n 's/msgstr "\(.*\)"/\1/p')
|
|
|
|
}
|
|
|
|
|
2020-09-03 04:43:30 -04:00
|
|
|
for PO in $(ls data/po/*.po); do
|
2020-09-06 12:08:44 -04:00
|
|
|
CUR_LANG=$(basename $PO .po)
|
2020-09-06 23:29:13 -04:00
|
|
|
if [ "$CUR_LANG" != "en" ]; then
|
|
|
|
printf "$CUR_LANG " >> data/po/LINGUAS
|
2020-09-07 01:01:48 -04:00
|
|
|
PO_NO_FALLBACK=$PO
|
|
|
|
if [ "$CUR_LANG" = "fr_CA" ]; then
|
|
|
|
PO_NO_FALLBACK="data/po/fr.po"
|
|
|
|
fi
|
|
|
|
TOTAL_STR=$(sed ':a;N;$!ba;s/\"\n\"//g' $PO_NO_FALLBACK | grep "msgid \"" | wc -l)
|
|
|
|
UNTRANSLATED_STR=$(sed ':a;N;$!ba;s/\"\n\"//g' $PO_NO_FALLBACK | grep "msgstr \"\"" | wc -l)
|
|
|
|
TRANSLATED_STR=$(expr $TOTAL_STR - $UNTRANSLATED_STR)
|
|
|
|
PERCENTAGE=$(python -c "print(int($TRANSLATED_STR / $TOTAL_STR * 100.0))")
|
|
|
|
if [ "$PERCENTAGE" = "0" ]; then
|
|
|
|
continue
|
|
|
|
elif [ "$PERCENTAGE" != "100" ]; then
|
|
|
|
printf " <lang percentage=\"$PERCENTAGE\">$CUR_LANG</lang>" >> supertuxkart.appdata.xml
|
|
|
|
else
|
|
|
|
printf " <lang>$CUR_LANG</lang>" >> supertuxkart.appdata.xml
|
|
|
|
fi
|
2020-09-03 04:43:30 -04:00
|
|
|
fi
|
2020-09-06 12:08:44 -04:00
|
|
|
if [ "$1" != "--generate-google-play-msg" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
DESC=$(translate_str "$STK_DESCRIPTION" "$PO")
|
|
|
|
P1=$(translate_str "$STK_APPDATA_P1" "$PO")
|
|
|
|
P2=$(translate_str "$STK_APPDATA_P2" "$PO")
|
|
|
|
P3=$(translate_str "$STK_APPDATA_P3" "$PO")
|
|
|
|
P4=$(translate_str "$STK_APPDATA_P4" "$PO")
|
2020-09-06 12:45:36 -04:00
|
|
|
P5=$(translate_str "$STK_APPDATA_P5" "$PO")
|
|
|
|
P6=$(translate_str "$STK_APPDATA_P6" "$PO")
|
|
|
|
P7=$(translate_str "$STK_APPDATA_P7" "$PO")
|
|
|
|
if [ -n "$DESC" ] && [ -n "$P1" ] && [ -n "$P2" ] && [ -n "$P3" ] && \
|
|
|
|
[ -n "$P4" ] && [ -n "$P5" ] && [ -n "$P6" ] && [ -n "$P7" ]; then
|
2020-09-06 12:08:44 -04:00
|
|
|
mkdir -p ./google_play_msg/$CUR_LANG
|
2020-09-06 12:45:36 -04:00
|
|
|
P7=$(sed "s|%s|$STK_STABLE_URL|g" <<< $P7)
|
2020-09-06 12:08:44 -04:00
|
|
|
printf "$DESC" > google_play_msg/$CUR_LANG/short.txt
|
|
|
|
printf "$P1\n\n$P2\n\n$P3\n\n$P4" > google_play_msg/$CUR_LANG/full.txt
|
2020-09-06 12:45:36 -04:00
|
|
|
printf "$P1\n\n$P2\n\n$P3\n\n$P4\n\n---\n\n$P5\n\n$P6\n\n$P7" > google_play_msg/$CUR_LANG/full_beta.txt
|
2020-09-06 12:08:44 -04:00
|
|
|
fi
|
2020-09-03 04:43:30 -04:00
|
|
|
done
|
2020-09-07 01:01:48 -04:00
|
|
|
echo "${STK_APPDATA_FILE_6}" >> supertuxkart.appdata.xml
|
2020-09-03 04:43:30 -04:00
|
|
|
|
|
|
|
msgfmt --desktop -d data/po --template supertuxkart.desktop -o data/supertuxkart.desktop
|
2020-09-04 09:54:02 -04:00
|
|
|
msgfmt --xml -d data/po --template supertuxkart.appdata.xml -o data/supertuxkart.appdata.xml
|
2020-09-03 04:43:30 -04:00
|
|
|
rm -f ./supertuxkart.desktop
|
2020-09-04 09:54:02 -04:00
|
|
|
rm -f ./supertuxkart.appdata.xml
|
2020-09-03 04:43:30 -04:00
|
|
|
rm -f ./data/po/LINGUAS
|
2020-09-04 09:54:02 -04:00
|
|
|
rm -f ./data/po/zh_HK.po
|
2009-08-29 17:16:51 -04:00
|
|
|
|
2008-05-09 14:39:48 -04:00
|
|
|
echo " Done"
|
2010-05-25 14:47:38 -04:00
|
|
|
echo "---------------------------"
|