Fixed a lot of translation crap related to XML, hacky challenge files, no GUI, etc...

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4342 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-12-22 21:57:15 +00:00
parent 93e569c3a2
commit 7d1c82d73c
16 changed files with 814 additions and 742 deletions

View File

@ -2,9 +2,9 @@
<challenge
id="penguinplaygroundgp"
name="_(&quot;Win Penguin Playground Grand\nPrix&quot;)"
description="_(&quot;Win Penguin Playground Grand\nPrix with 3 &apos;Racer&apos; Level AI karts.&quot;)"
unlock-mode="followtheleader _(Follow the Leader)"
name="Win Penguin Playground Grand\nPrix"
description="Win Penguin Playground Grand\nPrix with 3 &apos;Racer&apos; Level AI karts."
unlock-mode="FOLLOW_LEADER"
major="grandprix"
minor="quickrace"
gp="penguinplayground"

View File

@ -2,8 +2,8 @@
<challenge
id="worldsend"
name="_(Win the At World's End\nGrand Prix)"
description="_(Come first in the At World's End\nGrand Prix with 3 'Racer'\nLevel AI karts.)"
name="Win the At World's End\nGrand Prix"
description="Come first in the At World's End\nGrand Prix with 3 'Racer'\nLevel AI karts."
unlock-gp="alltracks"
depend-on="islandfollow"
major="grandprix"

View File

@ -2,8 +2,8 @@
<challenge
id="islandfollow"
name="_(Follow the Leader on a\nDesert Island)"
description="_(Win a Follow the Leader race\nwith 3 AI karts\non a Desert Island.)"
name="Follow the Leader on a\nDesert Island"
description="Win a Follow the Leader race\nwith 3 AI karts\non a Desert Island."
unlock-gp="atworldsend"
depend-on="tothemoonandbackgp tollwayhead2head tollwaytime citytime"
major="single"

View File

@ -2,8 +2,8 @@
<challenge
id="tothemoonandbackgp"
name="_(Win To the Moon and Back\nGrand Prix)"
description="_(Win the To the Moon and Back\nGrand Prix with 3 'Racer'\nLevel AI karts.)"
name="Win To the Moon and Back\nGrand Prix"
description="Win the To the Moon and Back\nGrand Prix with 3 'Racer'\nLevel AI karts."
unlock-gp="snagdrive"
depend-on="energyshiftingsands junglefollow"
major="grandprix"

View File

@ -2,8 +2,8 @@
<challenge
id="energyshiftingsands"
name="_(Collect the Pharaohs Treasure)"
description="_(Finish with at least 9 nitro \npoints on 3 laps of Shifting Sands\nin under 2:20 minutes.)"
name="Collect the Pharaohs Treasure"
description="Finish with at least 9 nitro \npoints on 3 laps of Shifting Sands\nin under 2:20 minutes."
unlock-gp="tothemoonandback"
depend-on="energymathclass racetracktime"
major="single"

View File

@ -3,7 +3,7 @@ import sys
f = open('./data/po/gui_strings.h', 'w')
def traverse(node, level=0):
def traverse(node, isChallenge, level=0):
for e in node.childNodes:
if e.localName == None:
@ -14,23 +14,49 @@ def traverse(node, level=0):
comment = None
if e.hasAttribute("I18N"):
comment = e.getAttribute("I18N")
if e.hasAttribute("text"):
# print "Label=", e.getAttribute("text"), " Comment=", comment
line = ""
if comment == None:
line += "_(\"" + e.getAttribute("text") + "\")\n\n"
else:
line += "//I18N: " + comment + "\n_(\"" + e.getAttribute("text") + "\");\n\n"
f.write( line )
if isChallenge:
if e.hasAttribute("name"):
# print "Label=", e.getAttribute("name"), " Comment=", comment
line = ""
if comment == None:
line += "_(\"" + e.getAttribute("name") + "\")\n\n"
else:
line += "//I18N: " + comment + "\n_(\"" + e.getAttribute("name") + "\");\n\n"
f.write( line )
if e.hasAttribute("description"):
# print "Label=", e.getAttribute("description"), " Comment=", comment
line = ""
if comment == None:
line += "_(\"" + e.getAttribute("description") + "\")\n\n"
else:
line += "//I18N: " + comment + "\n_(\"" + e.getAttribute("description") + "\");\n\n"
f.write( line )
else:
if e.hasAttribute("text"):
# print "Label=", e.getAttribute("text"), " Comment=", comment
line = ""
if comment == None:
line += "_(\"" + e.getAttribute("text") + "\")\n\n"
else:
line += "//I18N: " + comment + "\n_(\"" + e.getAttribute("text") + "\");\n\n"
f.write( line )
traverse(e, level+1)
traverse(e, isChallenge, level+1)
filenames = sys.argv[1:]
for file in filenames:
print "Parsing", file
doc = xml.dom.minidom.parse(file)
traverse(doc)
isChallenge = False
if file.endswith(".challenge"):
isChallenge = True
doc = xml.dom.minidom.parse(file)
traverse(doc, isChallenge)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,9 @@
# ./data/po/update_pot.sh
CPP_FILE_LIST=`find ./src -name '*.cpp' -print`
PERL_FILE_LIST="`find ./data -name '*.track' -print` `find ./data -name '*.challenge' -print` `find ./data -name '*.grandprix' -print`"
LISP_FILE_LIST="`find ./data -name '*.track' -print` `find ./data -name '*.challenge' -print` `find ./data -name '*.grandprix' -print`"
XML_FILE_LIST=`find ./data -name '*.xml' -print`
STKGUI_FILE_LIST=`find ./data -name '*.stkgui' -print`
STKGUI_FILE_LIST=`find ./data -name '*.stkgui' -print && find ./data -name '*.challenge' -print`
echo "--------------------"
echo " Source Files :"
@ -15,7 +15,7 @@ echo $CPP_FILE_LIST
echo "--------------------"
echo " Data Files :"
echo "--------------------"
echo $PERL_FILE_LIST
echo $LISP_FILE_LIST
echo "--------------------"
echo " XMl Files :"
@ -37,7 +37,7 @@ echo " Generating .pot file..."
xgettext -d supertuxkart -s --keyword=_ --add-comments="I18N:" -p ./data/po -o supertuxkart.pot $CPP_FILE_LIST
# Lisp files
xgettext -j -L perl -d supertuxkart -s --keyword=_ --add-comments="I18N:" -p ./data/po -o supertuxkart.pot $PERL_FILE_LIST
xgettext -j -L lisp -d supertuxkart -s --keyword=_ --add-comments="I18N:" -p ./data/po -o supertuxkart.pot $LISP_FILE_LIST
# XML Files
xgettext -j -d supertuxkart -s --keyword=_ --add-comments="I18N:" -p ./data/po -o supertuxkart.pot ./data/po/gui_strings.h

View File

@ -22,11 +22,13 @@
#include <sstream>
#include "karts/kart.hpp"
#include "karts/kart_properties_manager.hpp"
#include "lisp/lisp.hpp"
#include "lisp/parser.hpp"
#include "modes/linear_world.hpp"
#include "race/grand_prix_data.hpp"
#include "race/grand_prix_manager.hpp"
#include "race/race_manager.hpp"
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#include "utils/translation.hpp"
@ -35,7 +37,7 @@ ChallengeData::ChallengeData(const std::string& filename)
{
m_filename = filename;
m_major = RaceManager::MAJOR_MODE_SINGLE;
m_minor = RaceManager::MINOR_MODE_QUICK_RACE;
m_minor = RaceManager::MINOR_MODE_NORMAL_RACE;
m_difficulty = RaceManager::RD_EASY;
m_num_laps = -1;
m_num_karts = -1;
@ -69,7 +71,7 @@ ChallengeData::ChallengeData(const std::string& filename)
if(mode=="timetrial")
m_minor = RaceManager::MINOR_MODE_TIME_TRIAL;
else if(mode=="quickrace")
m_minor = RaceManager::MINOR_MODE_QUICK_RACE;
m_minor = RaceManager::MINOR_MODE_NORMAL_RACE;
else if(mode=="followtheleader")
m_minor = RaceManager::MINOR_MODE_FOLLOW_LEADER;
else
@ -184,44 +186,42 @@ void ChallengeData::getUnlocks(const XMLNode *root, const std:: string type,
{
std:: string attrib;
root->get(type, &attrib);
if( attrib . empty() ) return;
if (attrib . empty()) return;
std:: vector< std:: string > data;
std:: size_t space = attrib.find_first_of(' ');
data.push_back( attrib.substr(0, space) );
if( space != std:: string:: npos )
{
data.push_back( attrib.substr(space, std:: string:: npos) );
}
//std:: vector< std:: string > data;
//std:: size_t space = attrib.find_first_of(' ');
//data.push_back( attrib.substr(0, space) );
//if( space != std:: string:: npos )
//{
// data.push_back( attrib.substr(space, std:: string:: npos) );
//}
switch(reward)
{
case UNLOCK_TRACK: addUnlockTrackReward (data[0] ); break;
case UNLOCK_GP: addUnlockGPReward (data[0] ); break;
case UNLOCK_MODE: if(1<data.size())
case UNLOCK_TRACK: addUnlockTrackReward (attrib );
break;
case UNLOCK_GP: addUnlockGPReward (attrib );
break;
case UNLOCK_MODE: addUnlockModeReward (attrib, RaceManager::getNameOf(attrib.c_str()));
break;
case UNLOCK_DIFFICULTY:
{
irr::core::stringw user_name = _(data[1].c_str());
addUnlockModeReward (data[0], user_name);
irr::core::stringw user_name = "?"; // TODO
addUnlockDifficultyReward(attrib, user_name);
break;
}
case UNLOCK_KART: const KartProperties* prop = kart_properties_manager->getKart(attrib);
if (prop == NULL)
{
std::cerr << "Challenge refers to kart " << attrib <<
", which is unknown. Ignoring challenge.\n";
break;
}
else
fprintf(stderr, "Unlock mode name missing.\n");
break;
case UNLOCK_DIFFICULTY: if(1<data.size())
{
irr::core::stringw user_name = _(data[1].c_str());
addUnlockDifficultyReward(data[0], user_name);
}
else
fprintf(stderr, "Difficult name missing.\n");
break;
case UNLOCK_KART: if(1<data.size())
{
irr::core::stringw user_name = _(data[1].c_str());
addUnlockKartReward(data[0], user_name);
}
else
fprintf(stderr, "Kart name missing.\n");
irr::core::stringw user_name = prop->getName();
addUnlockKartReward(attrib, user_name);
break;
} // switch
} // getUnlocks

View File

@ -529,7 +529,7 @@ void initRest()
race_manager->setNumPlayers(1);
race_manager->setNumLaps (3);
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
race_manager->setMinorMode (RaceManager::MINOR_MODE_QUICK_RACE);
race_manager->setMinorMode (RaceManager::MINOR_MODE_NORMAL_RACE);
race_manager->setDifficulty((RaceManager::Difficulty)(int)UserConfigParams::m_difficulty);
// race_manager->setDifficulty(RaceManager::RD_HARD);
@ -697,7 +697,7 @@ int main(int argc, char *argv[] )
// Profiling
// =========
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
race_manager->setMinorMode (RaceManager::MINOR_MODE_QUICK_RACE);
race_manager->setMinorMode (RaceManager::MINOR_MODE_NORMAL_RACE);
race_manager->setDifficulty(RaceManager::RD_HARD);
network_manager->setupPlayerKartInfo();
race_manager->startNew();

View File

@ -69,7 +69,7 @@ RaceManager::RaceManager()
m_num_karts = UserConfigParams::m_num_karts;
m_difficulty = RD_HARD;
m_major_mode = MAJOR_MODE_SINGLE;
m_minor_mode = MINOR_MODE_QUICK_RACE;
m_minor_mode = MINOR_MODE_NORMAL_RACE;
m_track_number = 0;
m_active_race = false;
m_score_for_position = stk_config->m_scores;
@ -257,7 +257,7 @@ void RaceManager::startNextRace()
m_world = new ProfileWorld();
else if(m_minor_mode==MINOR_MODE_FOLLOW_LEADER)
m_world = new FollowTheLeaderRace();
else if(m_minor_mode==MINOR_MODE_QUICK_RACE ||
else if(m_minor_mode==MINOR_MODE_NORMAL_RACE ||
m_minor_mode==MINOR_MODE_TIME_TRIAL)
m_world = new StandardRace();
else if(m_minor_mode==MINOR_MODE_3_STRIKES)

View File

@ -26,6 +26,7 @@
#include "network/remote_kart_info.hpp"
#include "race/grand_prix_data.hpp"
#include "utils/translation.hpp"
class Kart;
class PlayerKart;
@ -82,7 +83,7 @@ public:
*/
enum MinorRaceModeType
{
MINOR_MODE_QUICK_RACE = LINEAR_RACE(0, true),
MINOR_MODE_NORMAL_RACE = LINEAR_RACE(0, true),
MINOR_MODE_TIME_TRIAL = LINEAR_RACE(1, true),
MINOR_MODE_FOLLOW_LEADER = LINEAR_RACE(2, false),
@ -99,13 +100,38 @@ public:
{
switch (mode)
{
case MINOR_MODE_QUICK_RACE: return IDENT_STD;
case MINOR_MODE_NORMAL_RACE: return IDENT_STD;
case MINOR_MODE_TIME_TRIAL: return IDENT_TTRIAL;
case MINOR_MODE_FOLLOW_LEADER: return FTL_IDENT;
case MINOR_MODE_3_STRIKES: return STRIKES_IDENT;
default: assert(false); return NULL;
}
}
static const wchar_t* getNameOf(const MinorRaceModeType mode)
{
switch (mode)
{
//I18N: Game mode
case MINOR_MODE_NORMAL_RACE: return _("Normal Race");
//I18N: Game mode
case MINOR_MODE_TIME_TRIAL: return _("Time Trial");
//I18N: Game mode
case MINOR_MODE_FOLLOW_LEADER: return _("Follow the Leader");
//I18N: Game mode
case MINOR_MODE_3_STRIKES: return _("3 Strikes Battle");
default: assert(false); return NULL;
}
}
static const wchar_t* getNameOf(const char* name)
{
if (strcmp(name, IDENT_STD) == 0) return getNameOf(MINOR_MODE_NORMAL_RACE);
else if (strcmp(name, IDENT_TTRIAL) == 0) return getNameOf(MINOR_MODE_TIME_TRIAL);
else if (strcmp(name, FTL_IDENT) == 0) return getNameOf(MINOR_MODE_FOLLOW_LEADER);
else if (strcmp(name, STRIKES_IDENT) == 0) return getNameOf(MINOR_MODE_3_STRIKES);
assert(0);
return NULL;
}
#undef LINEAR_RACE
#undef BATTLE_ARENA

View File

@ -79,7 +79,7 @@ RacePausedDialog::RacePausedDialog(const float percentWidth, const float percent
m_choice_ribbon->h = icon_size + text_height;
m_choice_ribbon->setParent(m_irrlicht_window);
if (race_manager->getMinorMode()==RaceManager::MINOR_MODE_QUICK_RACE)
if (race_manager->getMinorMode()==RaceManager::MINOR_MODE_NORMAL_RACE)
{
IconButtonWidget* ribbon_item = new IconButtonWidget();
ribbon_item->m_properties[PROP_ID] = "newrace";
@ -143,7 +143,7 @@ RacePausedDialog::RacePausedDialog(const float percentWidth, const float percent
50 widget_manager->addTextButtonWgt( WTOK_HELP, 50, 7, _("Help") );
51 widget_manager->addTextButtonWgt( WTOK_RESTART_RACE, 50, 7, _("Restart Race") );
52
53 if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_QUICK_RACE)
53 if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_NORMAL_RACE)
54 {
55 widget_manager->addTextButtonWgt( WTOK_SETUP_NEW_RACE, 50, 7,
56 _("Setup New Race") );

View File

@ -15,16 +15,20 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <irrlicht.h>
#include "challenges/unlock_manager.hpp"
#include "guiengine/widget.hpp"
#include "io/file_manager.hpp"
#include "race/race_manager.hpp"
#include "states_screens/arenas_screen.hpp"
#include "states_screens/race_setup_screen.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/tracks_screen.hpp"
#include "utils/translation.hpp"
#include "states_screens/race_setup_screen.hpp"
using namespace GUIEngine;
RaceSetupScreen::RaceSetupScreen() : Screen("racesetup.stkgui")
@ -63,7 +67,7 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, con
if (selectedMode == "normal")
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_QUICK_RACE);
race_manager->setMinorMode(RaceManager::MINOR_MODE_NORMAL_RACE);
StateManager::get()->pushScreen( TracksScreen::getInstance() );
}
else if (selectedMode == "timetrial")
@ -155,12 +159,15 @@ void RaceSetupScreen::init()
if (!m_inited)
{
// FIXME: find a nice name than 'regular race' -.-
w2->addItem( _("Regular Race\nAll blows allowed, so catch weapons and make clever use of them!"),
"normal", "/gui/mode_normal.png");
irr::core::stringw name1 = irr::core::stringw(RaceManager::getNameOf(RaceManager::MINOR_MODE_NORMAL_RACE)) +
L"\n" +
_("All blows allowed, so catch weapons and make clever use of them!");
w2->addItem( name1, "normal", "/gui/mode_normal.png");
w2->addItem( _("Time Trial\nContains no powerups, so only your driving skills matter!"),
"timetrial", "/gui/mode_tt.png");
irr::core::stringw name2 = irr::core::stringw(RaceManager::getNameOf(RaceManager::MINOR_MODE_TIME_TRIAL)) +
L"\n" +
_("Contains no powerups, so only your driving skills matter!");
w2->addItem( name2, "timetrial", "/gui/mode_tt.png");
if (unlock_manager->isLocked("followtheleader"))
{
@ -169,14 +176,18 @@ void RaceSetupScreen::init()
}
else
{
w2->addItem( _("Follow the Leader\nrun for second place, as the last kart will be disqualified every time the counter hits zero. Beware : going in front of the leader will get you eliminated too!"),
"ftl", "/gui/mode_ftl.png", false);
irr::core::stringw name3 = irr::core::stringw(RaceManager::getNameOf(RaceManager::MINOR_MODE_FOLLOW_LEADER)) +
L"\n" +
_("Run for second place, as the last kart will be disqualified every time the counter hits zero. Beware : going in front of the leader will get you eliminated too!");
w2->addItem(name3, "ftl", "/gui/mode_ftl.png", false);
}
if (race_manager->getNumPlayers() > 1)
{
w2->addItem( _("3-Strikes Battle\nonly in multiplayer games. Hit others with weapons until they lose all their lives."),
"3strikes", "/gui/mode_3strikes.png");
irr::core::stringw name4 = irr::core::stringw(RaceManager::getNameOf(RaceManager::MINOR_MODE_3_STRIKES)) +
L"\n" +
_("Hit others with weapons until they lose all their lives. (Only in multiplayer games)");
w2->addItem( name4, "3strikes", "/gui/mode_3strikes.png");
}
m_inited = true;