moved the translator init code earlier; added some translation support for the code of r2517 and r2907; updated some Chinese translation.

This commit is contained in:
linshier
2011-01-31 14:21:46 +00:00
parent 6bf8a1209d
commit 6bde3d0ee6
7 changed files with 85 additions and 39 deletions
+12 -5
View File
@@ -21,9 +21,10 @@ namespace
{
float kGamepadIconSize = 0.5f;
const std::string kInterruptString(": Interrupt");
const std::string kNoString(": No");
const std::string kNoToAllString(": No To All");
std::string kInterruptMessageString("Interrupt?");
std::string kInterruptString(": Interrupt");
std::string kNoString(": No");
std::string kNoToAllString(": No To All");
}
/*
@@ -636,6 +637,12 @@ ActionStack::ActionStack(GameObserver* game)
pspIcons[i] = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float) i * 32, 0, 32, 32, stream.str(), RETRIEVE_MANAGE);
pspIcons[i]->SetHotSpot(16, 16);
}
// fix for translation.
kInterruptMessageString = _(kInterruptMessageString);
kInterruptString = _(kInterruptString);
kNoString = _(kNoString);
kNoToAllString = _(kNoToAllString);
}
int ActionStack::has(MTGAbility * ability)
@@ -1101,9 +1108,9 @@ void ActionStack::Render()
// Mootpoint 01/12/2011: draw the interrupt text first, at the top. Offset the rest of the
// unresolved stack effects down so that they don't collide with the interrupt text.
if (options[Options::INTERRUPT_SECONDS].number == 0)
stream << "Interrupt?";
stream << kInterruptMessageString;
else
stream << "Interrupt? " << static_cast<int>(timer);
stream << kInterruptMessageString << " " << static_cast<int>(timer);
mFont->DrawString(stream.str(), x0 + 5, currenty);
+25 -24
View File
@@ -5,6 +5,7 @@
#include "JTypes.h"
#include "GameApp.h"
#include <iomanip>
#include "Translate.h"
DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const char * _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats) :
DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats)
@@ -64,31 +65,31 @@ void DeckEditorMenu::drawDeckStatistics()
ostringstream deckStatsString;
deckStatsString
<< "------- Deck Summary -----" << endl
<< "Cards: "<< stw->cardCount << endl
<< "Creatures: "<< setw(2) << stw->countCreatures
<< " Enchantments: " << stw->countEnchantments << endl
<< "Instants: " << setw(4) << stw->countInstants
<< " Sorceries: " << setw(2) << stw->countSorceries << endl
<< "Lands: "
<< "A: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] << " "
<< "G: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] + stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] << " "
<< "R: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_RED ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_RED ] << " "
<< "U: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLUE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLUE ] << " "
<< "B: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLACK ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLACK ] << " "
<< "W: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_WHITE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_WHITE ] << endl
<< " --- Card color count --- " << endl
<< "A: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_ARTIFACT) << " "
<< "G: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_GREEN) << " "
<< "U: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_BLUE) << " "
<< "R: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_RED) << " "
<< "B: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_BLACK) << " "
<< "W: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_WHITE) << endl
<< _("------- Deck Summary -----") << endl
<< _("Cards: ") << stw->cardCount << endl
<< _("Creatures: ") << setw(2) << stw->countCreatures
<< _(" Enchantments: ") << stw->countEnchantments << endl
<< _("Instants: ") << setw(4) << stw->countInstants
<< _(" Sorceries: ") << setw(2) << stw->countSorceries << endl
<< _("Lands: ")
<< _("A: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] << " "
<< _("G: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] + stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] << " "
<< _("R: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_RED ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_RED ] << " "
<< _("U: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLUE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLUE ] << " "
<< _("B: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLACK ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLACK ] << " "
<< _("W: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_WHITE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_WHITE ] << endl
<< _(" --- Card color count --- ") << endl
<< _("A: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_ARTIFACT) << " "
<< _("G: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_GREEN) << " "
<< _("U: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_BLUE) << " "
<< _("R: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_RED) << " "
<< _("B: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_BLACK) << " "
<< _("W: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_WHITE) << endl
<< " --- Average Cost --- " << endl
<< "Creature: "<< setprecision(2) << stw->avgCreatureCost << endl
<< "Mana: " << setprecision(2) << stw->avgManaCost << " "
<< "Spell: " << setprecision(2) << stw->avgSpellCost << endl;
<< _(" --- Average Cost --- ") << endl
<< _("Creature: ") << setprecision(2) << stw->avgCreatureCost << endl
<< _("Mana: ") << setprecision(2) << stw->avgManaCost << " "
<< _("Spell: ") << setprecision(2) << stw->avgSpellCost << endl;
WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
mainFont->DrawString(deckStatsString.str().c_str(), descX, descY + 25);
+1 -1
View File
@@ -200,7 +200,7 @@ void DeckMenu::Render()
if (showDetailsScreen())
{
float pspIconsSize = 0.5;
const string detailedInfoString = "Detailed Info";
const string detailedInfoString = _("Detailed Info");
float stringWidth = mainFont->GetStringWidth(detailedInfoString.c_str());
float boxStartX = detailedInfoBoxX - stringWidth / 2;
DWORD currentColor = mainFont->GetColor();
+2
View File
@@ -181,6 +181,8 @@ void GameApp::Create()
string lang = options[Options::LANG].str;
std::transform(lang.begin(), lang.end(), lang.begin(), ::tolower);
WResourceManager::Instance()->InitFonts(lang);
Translator::GetInstance()->init();
// The translator is ready now.
LOG("--Loading various textures");
WResourceManager::Instance()->RetrieveTexture("phasebar.png", RETRIEVE_MANAGE);
+2 -1
View File
@@ -465,7 +465,8 @@ void GameStateMenu::Update(float dt)
if (primitivesLoadCounter == -1)
{
listPrimitives();
Translator::GetInstance()->init();
// Move translator init to GameApp::Create().
// Translator::GetInstance()->init();
}
if (primitivesLoadCounter < (int) (primitives.size()))
{
+6 -2
View File
@@ -29,7 +29,8 @@ float GameStateShop::_y4[] = { 169, 188, 250, 182, 182, 168, 220, 208, 198, 259,
namespace
{
float kGamepadIconSize = 0.5f;
const std::string kOtherCardsString(": Other cards");
std::string kOtherCardsString(": Other cards");
std::string kCreditsString("Credits: ");
}
@@ -74,6 +75,9 @@ GameStateShop::GameStateShop(GameApp* parent) :
mCounts[i] = 0;
}
mTouched = false;
kOtherCardsString = _(kOtherCardsString);
kCreditsString = _(kCreditsString);
}
GameStateShop::~GameStateShop()
@@ -731,7 +735,7 @@ void GameStateShop::Render()
//Render the info bar
r->FillRect(0, SCREEN_HEIGHT - 17, SCREEN_WIDTH, 17, ARGB(128,0,0,0));
std::ostringstream stream;
stream << "Credits: " << playerdata->credits;
stream << kCreditsString << playerdata->credits;
mFont->SetColor(ARGB(255,255,255,255));
mFont->DrawString(stream.str(), 5, SCREEN_HEIGHT - 14);