1) Enhanced lisp scanner and parser to handle translations, i.e.

strings marked as _("translate me")
2) Added _() for all names and descriptions for the tracks and GPs
3) Improved update_pot.sh to create the entries for all track and
   GP files.
4) Updated supertuxkart.pot to include all GPs and tracks.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1844 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2008-05-10 14:48:57 +00:00
parent ea2beaf2ac
commit 6f55d4de70
10 changed files with 231 additions and 60 deletions

View File

@ -1,8 +1,8 @@
;; -*- mode: lisp -*-
(supertuxkart-cup
(name "All tracks")
(description "All 13 tracks included in SuperTuxKart")
(name _("All tracks"))
(description _("All 13 tracks included in SuperTuxKart"))
(tracks "beach" "startrack" "lighthouse" "jungle" "volcano" "islandtrack" "sandtrack" "fortmagma" "snowtuxpeak" "littlevolcano" "olivermath" "race" "city" "canyon" "subseatrack" "tuxtrack")
(laps 2 3 4 3 3 2 3 3 3 2 4 5 2 2 3 2)
)

View File

@ -1,8 +1,8 @@
;; -*- mode: lisp -*-
(supertuxkart-cup
(name "Penguin Playground")
(description "First grand prix, easy to get started")
(name _("Penguin Playground"))
(description _("First grand prix, easy to get started"))
(tracks "tuxtrack" "race" "olivermath")
(laps 3 5 4)
)

View File

@ -1,8 +1,8 @@
;; -*- mode: lisp -*-
(supertuxkart-cup
(name "To the Moon and Back")
(description "Second grand prix")
(name _("To the Moon and Back"))
(description _("Second grand prix"))
(tracks "beach" "startrack" "jungle" "lighthouse")
(laps 2 3 2 4)
)

View File

@ -1,8 +1,8 @@
;; -*- mode: lisp -*-
(supertuxkart-cup
(name "Snag Drive")
(description "Third grand prix")
(name _("Snag Drive"))
(description _("Third grand prix"))
(tracks "islandtrack" "sandtrack" "city" "littlevolcano")
(laps 2 3 2 2)
)

View File

@ -1,8 +1,8 @@
;; -*- mode: lisp -*-
(supertuxkart-cup
(name "At world's end")
(description "Last grand prix, longer and harder")
(name _("At world's end"))
(description _("Last grand prix, longer and harder"))
(tracks "fortmagma" "canyon" "subseatrack" "volcano" "snowtuxpeak")
(laps 3 2 3 3 3)
)

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-05-08 14:44-0400\n"
"POT-Creation-Date: 2008-05-11 00:46+1000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -28,12 +28,8 @@ msgid ""
"been eliminated."
msgstr ""
#: src/gui/race_options.cpp:104
msgid "3"
msgstr ""
#: src/gui/race_options.cpp:86
msgid "4"
#: src/main.cpp:132
msgid "--keyboard-debug"
msgstr ""
#: src/gui/player_controls.cpp:64
@ -44,6 +40,18 @@ msgstr ""
msgid "Active Challenges"
msgstr ""
#: data/all.cup:5
msgid "All 13 tracks included in SuperTuxKart"
msgstr ""
#: data/all.cup:4
msgid "All tracks"
msgstr ""
#: data/tracks/jungle/jungle.track:4
msgid "Amazonian Journey"
msgstr ""
#: src/gui/help_page_two.cpp:106
msgid "Anvil - slows down greatly the kart in the first position"
msgstr ""
@ -57,12 +65,20 @@ msgstr ""
msgid "Apply %dx%d"
msgstr ""
#: data/tracks/lighthouse/lighthouse.track:4
msgid "Around the Lighthouse"
msgstr ""
#: src/gui/help_page_one.cpp:112
msgid ""
"At high speeds wheelies drive you faster, but you can't steer. If you\n"
"get stuck or fall too far, use the rescue button to get back on track."
msgstr ""
#: data/gp4.cup:4
msgid "At world's end"
msgstr ""
#: src/gui/help_page_one.cpp:78
msgid "Avoid bananas"
msgstr ""
@ -76,6 +92,10 @@ msgstr ""
msgid "Brake"
msgstr ""
#: data/tracks/canyon/canyon.track:4
msgid "Canyon"
msgstr ""
#: src/gui/main_menu.cpp:52
msgid "Challenges"
msgstr ""
@ -105,6 +125,10 @@ msgstr ""
msgid "Choose your controls, %s"
msgstr ""
#: data/tracks/city/city.track:4
msgid "City"
msgstr ""
#: src/gui/config_display.cpp:97
msgid "Clear from Blacklist"
msgstr ""
@ -152,8 +176,8 @@ msgstr ""
msgid "Confirm Resolution Within 5 Seconds"
msgstr ""
#: src/gui/feature_unlocked.cpp:47 src/gui/grand_prix_ending.cpp:144
#: src/gui/leader_result.cpp:148 src/gui/race_results_gui.cpp:135
#: src/gui/grand_prix_ending.cpp:144 src/gui/leader_result.cpp:148
#: src/gui/feature_unlocked.cpp:47 src/gui/race_results_gui.cpp:135
msgid "Continue"
msgstr ""
@ -161,6 +185,50 @@ msgstr ""
msgid "Continue Grand Prix"
msgstr ""
#: data/tracks/littlevolcano/littlevolcano.track:5
#: data/tracks/race/race.track:5 data/tracks/startrack/startrack.track:6
#: data/tracks/subseatrack/subseatrack.track:5
#: data/tracks/volcano/volcano.track:5
msgid "Created by Ingo Ruhnke"
msgstr ""
#: data/tracks/beach/beach.track:5 data/tracks/lighthouse/lighthouse.track:5
msgid ""
"Created by Ingo Ruhnke,\n"
"modified by M. Gagnon"
msgstr ""
#: data/tracks/islandtrack/islandtrack.track:5
msgid "Created by Johannes Sjolund"
msgstr ""
#: data/tracks/olivermath/olivermath.track:5
#: data/tracks/tuxtrack/tuxtrack.track:5
msgid "Created by Oliver & Steve Baker"
msgstr ""
#: data/tracks/fortmagma/fortmagma.track:5
msgid ""
"Created by Oliver & Steve Baker\n"
"modified by Marianne Gagnon"
msgstr ""
#: data/tracks/snowtuxpeak/snowtuxpeak.track:5
msgid ""
"Created by Oliver & Steve Baker,\n"
" modified by M. Gagnon"
msgstr ""
#: data/tracks/sandtrack/sandtrack.track:5
msgid ""
"Created by Oliver & Steve Baker,\n"
"modified by M. Gagnon"
msgstr ""
#: data/tracks/canyon/canyon.track:5 data/tracks/city/city.track:5
msgid "Created by Thomas Oppl"
msgstr ""
#: src/gui/main_menu.cpp:63
msgid "Credits"
msgstr ""
@ -186,7 +254,7 @@ msgstr ""
msgid "Display Settings"
msgstr ""
#: src/gui/race_options.cpp:151 src/gui/race_options.cpp:166
#: src/gui/race_options.cpp:151 src/gui/race_options.cpp:165
msgid "Driver"
msgstr ""
@ -231,7 +299,7 @@ msgstr ""
msgid "Finish the City track in 5:20"
msgstr ""
#: src/gui/race_gui.cpp:768
#: src/gui/race_gui.cpp:784
#, c-format
msgid "Finished"
msgstr ""
@ -240,6 +308,10 @@ msgstr ""
msgid "Fire"
msgstr ""
#: data/gp1.cup:5
msgid "First grand prix, easy to get started"
msgstr ""
#: src/gui/game_mode.cpp:73
msgid "Follow the Leader"
msgstr ""
@ -258,6 +330,10 @@ msgstr ""
msgid "Force your rivals bite *your* dust!"
msgstr ""
#: data/tracks/fortmagma/fortmagma.track:4
msgid "Fort Magma"
msgstr ""
#: src/gui/num_players.cpp:40
msgid "Four Players"
msgstr ""
@ -271,12 +347,12 @@ msgstr ""
msgid "Fuzzy blob/Spark - very slow, but bounces from walls"
msgstr ""
#: src/gui/challenges_menu.cpp:51 src/gui/credits_menu.cpp:76
#: src/gui/help_page_one.cpp:148 src/gui/help_page_two.cpp:116
#: src/gui/credits_menu.cpp:76 src/gui/help_page_two.cpp:116
#: src/gui/help_page_one.cpp:148 src/gui/challenges_menu.cpp:51
msgid "Go back to the main menu"
msgstr ""
#: src/gui/race_gui.cpp:916
#: src/gui/race_gui.cpp:932
msgid "Go!"
msgstr ""
@ -317,10 +393,14 @@ msgstr ""
msgid "Jump"
msgstr ""
#: src/gui/race_gui.cpp:773
#: src/gui/race_gui.cpp:789
msgid "Lap"
msgstr ""
#: data/gp4.cup:5
msgid "Last grand prix, longer and harder"
msgstr ""
#: src/gui/race_gui.cpp:408
msgid "Leader"
msgstr ""
@ -334,6 +414,10 @@ msgstr ""
msgid "Less"
msgstr ""
#: data/tracks/littlevolcano/littlevolcano.track:4
msgid "Little Volcano"
msgstr ""
#: src/gui/start_race_feedback.cpp:35
msgid "Loading race..."
msgstr ""
@ -404,13 +488,6 @@ msgid ""
"now available"
msgstr ""
#: src/challenges/win_gotm_cup.cpp:30
msgid ""
"New track\n"
"'Amazonian Journey'\n"
"available"
msgstr ""
#: src/challenges/race_track_time.cpp:29
msgid ""
"New track: Amazonian Journey\n"
@ -453,7 +530,7 @@ msgstr ""
msgid "No track selected"
msgstr ""
#: src/gui/race_options.cpp:171
#: src/gui/race_options.cpp:170
msgid "Novice"
msgstr ""
@ -469,7 +546,15 @@ msgstr ""
msgid "Old config file found, check your key bindings!"
msgstr ""
#: src/gui/main_menu.cpp:55 src/gui/options.cpp:40 src/gui/race_menu.cpp:50
#: data/tracks/olivermath/olivermath.track:4
msgid "Oliver's Math Class"
msgstr ""
#: data/tracks/beach/beach.track:4
msgid "On the Beach"
msgstr ""
#: src/gui/options.cpp:40 src/gui/main_menu.cpp:55 src/gui/race_menu.cpp:50
msgid "Options"
msgstr ""
@ -481,11 +566,15 @@ msgstr ""
msgid "Paused"
msgstr ""
#: src/gui/race_gui.cpp:942
#: src/gui/race_gui.cpp:958
msgid "Penalty time!!"
msgstr ""
#: src/gui/player_controls.cpp:246
#: data/gp1.cup:4
msgid "Penguin Playground"
msgstr ""
#: src/gui/player_controls.cpp:251
msgid "Player "
msgstr ""
@ -522,15 +611,15 @@ msgstr ""
msgid "Press <ESC> to Cancel"
msgstr ""
#: src/gui/config_controls.cpp:52 src/gui/config_display.cpp:101
#: src/gui/config_sound.cpp:63 src/gui/game_mode.cpp:78
#: src/gui/grand_prix_select.cpp:87 src/gui/num_players.cpp:45
#: src/gui/options.cpp:57 src/gui/player_controls.cpp:107
#: src/gui/race_options.cpp:121
#: src/gui/options.cpp:57 src/gui/player_controls.cpp:112
#: src/gui/race_options.cpp:121 src/gui/config_display.cpp:101
#: src/gui/game_mode.cpp:78 src/gui/config_sound.cpp:63
#: src/gui/config_controls.cpp:52 src/gui/grand_prix_select.cpp:87
#: src/gui/num_players.cpp:45
msgid "Press <ESC> to go back"
msgstr ""
#: src/gui/player_controls.cpp:151
#: src/gui/player_controls.cpp:156
msgid "Press key"
msgstr ""
@ -546,10 +635,14 @@ msgstr ""
msgid "Quit"
msgstr ""
#: src/gui/race_gui.cpp:714
#: src/gui/race_gui.cpp:730
msgid "REV"
msgstr ""
#: data/tracks/race/race.track:4
msgid "Race Track"
msgstr ""
#: src/gui/race_results_gui.cpp:148
msgid "Race in this track again"
msgstr ""
@ -559,11 +652,11 @@ msgid "Race results"
msgstr ""
#: src/gui/race_options.cpp:69 src/gui/race_options.cpp:146
#: src/gui/race_options.cpp:160
#: src/gui/race_options.cpp:159
msgid "Racer"
msgstr ""
#: src/gui/race_gui.cpp:898
#: src/gui/race_gui.cpp:914
msgid "Ready!"
msgstr ""
@ -587,7 +680,11 @@ msgstr ""
msgid "Right"
msgstr ""
#: src/gui/race_gui.cpp:907
#: data/gp2.cup:5
msgid "Second grand prix"
msgstr ""
#: src/gui/race_gui.cpp:923
msgid "Set!"
msgstr ""
@ -595,6 +692,10 @@ msgstr ""
msgid "Setup New Race"
msgstr ""
#: data/tracks/sandtrack/sandtrack.track:4
msgid "Shifting Sands"
msgstr ""
#: src/gui/main_menu.cpp:46
msgid "Single Player"
msgstr ""
@ -603,6 +704,14 @@ msgstr ""
msgid "Skidding Preview"
msgstr ""
#: data/gp3.cup:4
msgid "Snag Drive"
msgstr ""
#: data/tracks/snowtuxpeak/snowtuxpeak.track:4
msgid "SnowTux Peak"
msgstr ""
#: src/gui/options.cpp:52
msgid "Sound"
msgstr ""
@ -611,15 +720,31 @@ msgstr ""
msgid "Sound Settings"
msgstr ""
#: data/tracks/startrack/startrack.track:4
msgid "Star Track"
msgstr ""
#: src/gui/race_options.cpp:118
msgid "Start race"
msgstr ""
#: data/tracks/subseatrack/subseatrack.track:4
msgid "Sub Sea"
msgstr ""
#: data/tracks/islandtrack/islandtrack.track:4
msgid "The Island"
msgstr ""
#: src/gui/grand_prix_ending.cpp:107 src/gui/leader_result.cpp:109
#, c-format
msgid "The winner is %s!"
msgstr ""
#: data/gp3.cup:5
msgid "Third grand prix"
msgstr ""
#: src/gui/num_players.cpp:39
msgid "Three Players"
msgstr ""
@ -632,6 +757,10 @@ msgstr ""
msgid "To help you win, there are certain collectables you can grab:"
msgstr ""
#: data/gp2.cup:4
msgid "To the Moon and Back"
msgstr ""
#: src/gui/config_sound.cpp:45 src/gui/config_sound.cpp:90
msgid "Turn off music"
msgstr ""
@ -648,10 +777,18 @@ msgstr ""
msgid "Turn on sound effects"
msgstr ""
#: data/tracks/tuxtrack/tuxtrack.track:4
msgid "Tux Tollway"
msgstr ""
#: src/gui/num_players.cpp:38
msgid "Two Players"
msgstr ""
#: data/tracks/volcano/volcano.track:4
msgid "Volcano"
msgstr ""
#: src/player_kart.cpp:264
msgid "WRONG WAY!"
msgstr ""
@ -660,10 +797,6 @@ msgstr ""
msgid "Wheelie"
msgstr ""
#: src/challenges/win_gotm_cup.cpp:27
msgid "Win GOTM Cup"
msgstr ""
#: src/challenges/penguin_playground_gp.cpp:25
msgid ""
"Win Penguin Playground Grand\n"
@ -715,14 +848,6 @@ msgid ""
"Grand Prix"
msgstr ""
#: src/challenges/win_gotm_cup.cpp:29
msgid ""
"Win the GOTM Cup\n"
"on level 'racer'\n"
"with at least\n"
"three computer opponents."
msgstr ""
#: src/challenges/moon_and_back_gp.cpp:27
msgid ""
"Win the To the Moon and Back\n"
@ -752,6 +877,10 @@ msgstr ""
msgid "Zipper - speed boost"
msgstr ""
#: data/tracks/jungle/jungle.track:5
msgid "by M. Gagnon"
msgstr ""
#: src/user_config.cpp:836
#, c-format
msgid "joy %d axis %d %c"

View File

@ -3,14 +3,20 @@
# ./data/po/update_pot.sh
CPP_FILE_LIST=`find ./src -name '*.cpp' -print`
PERL_FILE_LIST="./data/tracks/*/*.track ./data/*.cup"
echo "--------------------"
echo " Files :"
echo " Source Files :"
echo "--------------------"
echo $CPP_FILE_LIST
echo "--------------------"
echo " Data Files :"
echo "--------------------"
echo $PERL_FILE_LIST
echo "---------------------------"
echo " Generating .pot file..."
xgettext -d supertuxkart -s --keyword=_ -p ./data/po -o supertuxkart.pot ./src/*.cpp ./src/*/*.cpp
xgettext -d supertuxkart -s --keyword=_ -p ./data/po -o supertuxkart.pot $CPP_FILE_LIST
xgettext -j -L perl -d supertuxkart -s --keyword=_ -p ./data/po -o supertuxkart.pot $PERL_FILE_LIST
echo " Done"
echo "---------------------------"

View File

@ -196,6 +196,21 @@ namespace lisp
throw std::runtime_error(msg);
}
case '_': // can be begin translation
try
{
nextChar();
if(*m_c == '(')
{
nextChar();
return TOKEN_TRANSLATION;
}
m_token_string[m_token_length++] = '_';
// Fall through to symbol handling
}
catch(EOFException& )
{
}
default:
if(isdigit(*m_c) || *m_c == '-')
{

View File

@ -31,6 +31,7 @@ namespace lisp
TOKEN_EOF,
TOKEN_OPEN_PAREN,
TOKEN_CLOSE_PAREN,
TOKEN_TRANSLATION,
TOKEN_SYMBOL,
TOKEN_STRING,
TOKEN_INTEGER,

View File

@ -102,6 +102,26 @@ namespace lisp
m_lexer->getLineNumber());
throw std::runtime_error(msg);
}
case Lexer::TOKEN_TRANSLATION:
{
result = new Lisp(Lisp::TYPE_STRING);
m_token = m_lexer->getNextToken();
Lisp* next=read();
if(next->getType()!=Lisp::TYPE_STRING)
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Parse Error at line %d: No string inside translation.",
m_lexer->getLineNumber());
throw std::runtime_error(msg);
}
const char* trans=_(next->m_v.m_string);
const size_t LEN = strlen(trans) + 1;
result->m_v.m_string = new char[LEN];
memcpy(result->m_v.m_string, trans, LEN);
delete next;
break;
}
case Lexer::TOKEN_OPEN_PAREN:
result = new Lisp(Lisp::TYPE_CONS);