diff --git a/projects/mtg/bin/Res/lang/dontcare.txt b/projects/mtg/bin/Res/lang/dontcare.txt new file mode 100644 index 000000000..6d60ce39f --- /dev/null +++ b/projects/mtg/bin/Res/lang/dontcare.txt @@ -0,0 +1,56 @@ +#Translations that we don't need to have +#Before you remove a text from this file, be sure to understand why it has been put here! += +10= +Alliance (***)= +Angelism (*)= +AshenmoorCohort = +Bad Dreams = +Bad Moon = +Badlands (***)= +Ball Lightning (= +Burning = +Deep Blue = +Depletion = +Dragons = +Elfball = +Elves = +Faeries (*)= +Fairy Archmage = +Giants! = +Heartmender = +Howlings = +Inquisitor (***)= +Jihad = +Jungle = +Justice = +Kinsb. Cavalier = +Kithkin = +Kobold Overlord = +Lafiel = +Master of Ether = +Might Sliver = +Millage = +Nightmare (***)= +Noble Panther = +Panda Hive (***)= +Plateau (*)= +Rats! = +Savannah = +Selesnya (***)= +Shatter = +Snake Shamans = +Soldiers = +Spectral Rack (*= +Taiga = +Terror = +Treefolk = +Tsabo = +Undead Lord = +Vigilant Watch = +Whenever another creature enters the battlefield, you gain 1 life.= +Wrath (***)= +Yavimaya (***)= +Zuberi's Flock (= +deck2= + diff --git a/projects/mtg/bin/Res/lang/fr.txt b/projects/mtg/bin/Res/lang/fr.txt index e6e186384..f8e8053ba 100644 --- a/projects/mtg/bin/Res/lang/fr.txt +++ b/projects/mtg/bin/Res/lang/fr.txt @@ -7,6 +7,83 @@ # If you want to translate creature types and other game elements, do it in this file. Only the "text=" can be done directly in _cards.dat #Limitation: Special characters that are not in the limited 128 ASCII set CAN NOT be put in this file, it will display as garbage +# +#Added in 0.9.1 +# + +#Options +Artist: %s=Artiste : %s +Both=Les deux +Closed hand=Main fermee +Credits=Credits +Default=Defaut +Disable card image loading=Desactiver images des cartes +Eye candy=Cool +Game=Jeu +General Options=Options generales +Hand direction=Orientation main +Interface Options=Options d'interface +Interrupt my abilities=Interrompre mes abilites +Interrupt my spells=Interrompre mes sorts +Mana display=Affichage Mana +Max=Max +Mute=Silencieux +New Profile=Nouveau Profil +Options=Options +Reverse left and right triggers=Inverser RTrigger et LTrigger +Settings=Parametres +Simple=Simple +Theme: %s=Theme: %s +Use this Theme=Utiliser ce theme +User=Joueur +User Options=Options Joueur +horizontal=horizontal +invisible=invisible +vertical=vertical +visible=visible + +# Deck Editor +# - Total number of cards with given cost=# - Total de Cartes avec ce cout +Average converted mana cost=Cout converti moyen de mana +Average converted mana cost: %2.2f=Cout moyen de mana converti : %2.2f +C - Converted mana cost. Cards with cost>%i are included in the last row.=C - Cout converti. Les cartes avec un cout >%i sont incluses dans la derniere ligne. +Card counts per mana cost:=Nb de cartes par cout de mana +Creatures=Creatures +Enchantments=Enchantements +Games played=Parties jouees +Games played: %i=Parties jouees: %i +Instants=Ephemeres +Lands=Terrains +No creatures in 1st hand=0 creature dans 1ere main +No creatures in first n cards:=0 creature dans n 1eres cartes. +No land in 1st hand=0 Terrain dans 1ere main +No land in 9 cards=0 Terrain dans 1eres 9 cartes +No lands in first n cards:=0 Terrain dans 1eres n cartes +Playgame statistics=Statistiques de jeu +Press L/R to cycle through=Appuyez sur L/R Pour naviguer dans +deck statistics.=les stats du deck. +Probabilities=Probabilites +Save & Rename=Sauver & Renommer +Sorceries=Rituels +Spells=Sorts +Switch decks without saving=Annuler & Changer de Deck +Total colored manasymbols in cards' casting costs:=Total de symboles de mana dans le cout des cartes +Total price (credits)=Prix total (credits) +Victories against AI:=Victoires contre l'IA +Victory ratio: %i%%=Victoires :%i%% +menu=menu +statsPage#: %i=Stats, page #: %i + +#Other +Attacker=Attaquant +Demo=Demo +Momir Basic=Momir Basic +Test Suite=Suite de Tests + + +# +# Wagic 0.8.1 and below +# #Game menus/texts LOADING SET: %s=CHARGEMENT SET: %s @@ -130,7 +207,7 @@ Display collection=Afficher collection Your Deck: %i cards=Votre Deck: %i cartes You are currently viewing your=Vous etes sur votre collection. Press TRIANGLE=collection. Appuyez sur TRIANGLE -to switch to your deck=pour voir votre deck +to switch to your deck.=pour voir votre deck. deck. Press TRIANGLE to=deck. Appuyez sur TRIANGLE switch to your collection=pour voir votre collection Your Deck: %i cards=votre deck: %i cartes @@ -139,39 +216,41 @@ No Card=Pas de carte Deck info=Info deck Sell card=Vendre carte #types -artifact=artefact -enchantment=enchantement -sorcery=rituel -instant=ephemere -land=terrain +Artifact=artefact +Creature=Creature +Enchantment=enchantement +Sorcery=rituel +Instant=ephemere +Land=terrain #subtypes #please keep the english alphabetical order, makes it easier to update! -angel=ange -basic=basique -bird=oiseau -cat=chat -centaur=centaure -elf=elfe -forest=foret -goblin=gobelin -hound=chien -human=humain -island=ile -knight=chevalier -minotaur=minotaure -mountain=montagne -plains=plaine -sliver=slivoide -sorcerer=sorcier -soldier=soldat -specter=spectre -spider=araignee -swamp=marais -wall=mur -warrior=guerrier -wolf=loup -wurm=guivre +Angel=Ange +Basic=Basique +Bird=Oiseau +Cat=Chat +Centaur=Centaure +Elf=Elfe +Forest=Foret +Goblin=Gobelin +Hound=Chien +Human=Humain +Island=Ile +Knight=Chevalier +Minotaur=Minotaure +Mountain=Montagne +Plains=Plaine +Sliver=Slivoide +Sorcerer=Sorcier +Soldier=Soldat +Specter=Spectre +Spider=Araignee +Swamp=Marais +Wall=Mur +Wolf=Loup +Wurm=Guivre +Warrior=Guerrier +Archer=Archer #card names diff --git a/projects/mtg/include/SimpleMenu.h b/projects/mtg/include/SimpleMenu.h index e8a16ec09..41691520f 100644 --- a/projects/mtg/include/SimpleMenu.h +++ b/projects/mtg/include/SimpleMenu.h @@ -39,6 +39,7 @@ class SimpleMenu:public JGuiController{ void drawVertPole(int x, int y, int height); public: + bool autoTranslate; SimpleMenu(int id, JGuiListener* listener, JLBFont* font, int x, int y, const char * _title = "", int _maxItems = 7); void Render(); void Update(float dt); diff --git a/projects/mtg/include/SimpleMenuItem.h b/projects/mtg/include/SimpleMenuItem.h index 17937c550..c997a97e9 100644 --- a/projects/mtg/include/SimpleMenuItem.h +++ b/projects/mtg/include/SimpleMenuItem.h @@ -25,7 +25,7 @@ class SimpleMenuItem: public JGuiObject public: string desc; - SimpleMenuItem(SimpleMenu* _parent, int id, JLBFont *font, string text, int x, int y, bool hasFocus = false); + SimpleMenuItem(SimpleMenu* _parent, int id, JLBFont *font, string text, int x, int y, bool hasFocus = false, bool autoTranslate = false); int mX; int mY; diff --git a/projects/mtg/include/Translate.h b/projects/mtg/include/Translate.h index 5a7dda9d9..54276312c 100644 --- a/projects/mtg/include/Translate.h +++ b/projects/mtg/include/Translate.h @@ -1,23 +1,34 @@ -#ifndef _TRANSLATE_H_ -#define _TRANSLATE_H_ - -#include -#include - -using namespace std; - -class Translator{ +#ifndef _TRANSLATE_H_ +#define _TRANSLATE_H_ + +#include +#include + + +#if defined WIN32 +#define DEBUG_TRANSLATE +#endif + +using namespace std; + +class Translator{ protected: - static Translator * mInstance; -public: - map values; - string translate(string toTranslate); - Translator(); - int Add(string from, string to); + static Translator * mInstance; +public: + map values; +#if defined DEBUG_TRANSLATE + map missingValues; + map dontCareValues; + int checkMisses; +#endif + string translate(string toTranslate); + Translator(); + ~Translator(); + int Add(string from, string to); static Translator * GetInstance(); - static void EndInstance(); -}; - -string _(string toTranslate); - + static void EndInstance(); +}; + +string _(string toTranslate); + #endif \ No newline at end of file diff --git a/projects/mtg/src/GameState.cpp b/projects/mtg/src/GameState.cpp index 8ec0ad4c2..a05738d63 100644 --- a/projects/mtg/src/GameState.cpp +++ b/projects/mtg/src/GameState.cpp @@ -9,6 +9,7 @@ int GameState::fillDeckMenu(SimpleMenu * _menu, string path, string smallDeckPrefix, Player * statsPlayer){ int found = 1; int nbDecks = 0; + _menu->autoTranslate = false; while (found){ found = 0; char buffer[512]; diff --git a/projects/mtg/src/GameStateMenu.cpp b/projects/mtg/src/GameStateMenu.cpp index 5f43ba4b8..4e9b0178b 100644 --- a/projects/mtg/src/GameStateMenu.cpp +++ b/projects/mtg/src/GameStateMenu.cpp @@ -11,7 +11,7 @@ #include "../include/utils.h" #include "../include/DeckDataWrapper.h" -static const char* GAME_VERSION = "WTH?! 0.9.1 - by wololo"; +static const char* GAME_VERSION = "WTH?! 0.9.2 - by wololo"; #define DEFAULT_ANGLE_MULTIPLIER 0.4 #define MAX_ANGLE_MULTIPLIER (3*M_PI) diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index 557213ce3..de6e40eb9 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -165,7 +165,7 @@ void GameStateOptions::Render() for (int i = 0; i < size; i++){ pos = startpos +20*i; if (pos > -20){ - mFont->DrawString(_(CreditsText[i]).c_str(),SCREEN_WIDTH/2,pos ,JGETEXT_CENTER); + mFont->DrawString(CreditsText[i],SCREEN_WIDTH/2,pos ,JGETEXT_CENTER); } } diff --git a/projects/mtg/src/OptionItem.cpp b/projects/mtg/src/OptionItem.cpp index becc9970f..036aa858f 100644 --- a/projects/mtg/src/OptionItem.cpp +++ b/projects/mtg/src/OptionItem.cpp @@ -44,7 +44,7 @@ void WGuiItem::Render(){ mFont->SetColor(getColor(WGuiColor::TEXT)); JRenderer * renderer = JRenderer::GetInstance(); float fH = (height-mFont->GetHeight())/2; - mFont->DrawString(displayValue.c_str(),x+(width/2),y+fH,JGETEXT_CENTER); + mFont->DrawString(_(displayValue).c_str(),x+(width/2),y+fH,JGETEXT_CENTER); } WGuiItem::WGuiItem(string _display){ @@ -67,7 +67,7 @@ void WGuiHeader::Render(){ mFont->SetColor(getColor(WGuiColor::TEXT)); JRenderer * renderer = JRenderer::GetInstance(); - mFont->DrawString(displayValue.c_str(),x+width/2,y,JGETEXT_CENTER); + mFont->DrawString(_(displayValue).c_str(),x+width/2,y,JGETEXT_CENTER); } //WGuiText @@ -77,7 +77,7 @@ void WGuiText::Render(){ mFont->SetColor(getColor(WGuiColor::TEXT_BODY)); JRenderer * renderer = JRenderer::GetInstance(); - mFont->DrawString(displayValue.c_str(),x,y,JGETEXT_LEFT); + mFont->DrawString(_(displayValue).c_str(),x,y,JGETEXT_LEFT); mFont->SetScale(1); } @@ -93,7 +93,7 @@ void OptionInteger::Render(){ mFont->SetColor(getColor(WGuiColor::TEXT)); JRenderer * renderer = JRenderer::GetInstance(); - mFont->DrawString(displayValue.c_str(),x,y); + mFont->DrawString(_(displayValue).c_str(),x,y); char buf[512]; if (maxValue == 1){ if (value){ @@ -103,7 +103,7 @@ void OptionInteger::Render(){ } }else{ if(value == defValue && strDefault.size()) - sprintf(buf, "%s", strDefault.c_str()); + sprintf(buf, "%s", _(strDefault).c_str()); else sprintf(buf, "%i", value); } @@ -144,12 +144,12 @@ void OptionSelect::Render(){ mFont->SetColor(getColor(WGuiColor::TEXT)); JRenderer * renderer = JRenderer::GetInstance(); - mFont->DrawString(displayValue.c_str(),x,y); + mFont->DrawString(_(displayValue).c_str(),x,y); if (value < selections.size()) - mFont->DrawString(selections[value].c_str(),x+width-10,y,JGETEXT_RIGHT); + mFont->DrawString(_(selections[value]).c_str(),x+width-10,y,JGETEXT_RIGHT); else - mFont->DrawString("Unset",x+width-10,y,JGETEXT_RIGHT); + mFont->DrawString(_("Unset").c_str(),x+width-10,y,JGETEXT_RIGHT); } void OptionSelect::setData(){ @@ -433,7 +433,7 @@ void WGuiList::Render(){ if (!nbitems && failMsg != ""){ JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT); mFont->SetColor(getColor(WGuiColor::TEXT_FAIL)); - mFont->DrawString(failMsg.c_str(),x+width/2, y, JGETEXT_RIGHT); + mFont->DrawString(_(failMsg).c_str(),x+width/2, y, JGETEXT_RIGHT); return; } @@ -617,12 +617,12 @@ void OptionString::Render(){ JRenderer * renderer = JRenderer::GetInstance(); if(!bShowValue){ - mFont->DrawString(displayValue.c_str(),x+(width/2),y,JGETEXT_CENTER); + mFont->DrawString(_(displayValue).c_str(),x+(width/2),y,JGETEXT_CENTER); } else{ - mFont->DrawString(displayValue.c_str(),x,y); + mFont->DrawString(_(displayValue).c_str(),x,y); int w = mFont->GetStringWidth(value.c_str()-10); - mFont->DrawString(value.c_str(),width - w,y,JGETEXT_RIGHT); + mFont->DrawString(_(value).c_str(),width - w,y,JGETEXT_RIGHT); } } @@ -692,7 +692,7 @@ void OptionTheme::Render(){ file.close(); } } - sprintf(buf,"Theme: %s",selections[value].c_str()); + sprintf(buf,_("Theme: %s").c_str(),selections[value].c_str()); if(q){ float scale = 128 / q->mHeight; @@ -704,7 +704,7 @@ void OptionTheme::Render(){ mFont->SetColor(getColor(WGuiColor::TEXT_BODY)); mFont->SetScale(.8); float hi = mFont->GetHeight(); - sprintf(buf,"Artist: %s",author.c_str()); + sprintf(buf,_("Artist: %s").c_str(),author.c_str()); mFont->DrawString(buf,x,y+getHeight()-hi); mFont->SetScale(1); } @@ -754,10 +754,10 @@ void WDecoEnum::Render() JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT); mFont->SetColor(getColor(WGuiColor::TEXT)); JRenderer * renderer = JRenderer::GetInstance(); - mFont->DrawString(getDisplay().c_str(),getX(),getY()); + mFont->DrawString(_(getDisplay()).c_str(),getX(),getY()); OptionInteger* opt = dynamic_cast(it); if(opt) - mFont->DrawString(lookupVal(opt->value).c_str(), getWidth() -10, getY(), JGETEXT_RIGHT); + mFont->DrawString(_(lookupVal(opt->value)).c_str(), getWidth() -10, getY(), JGETEXT_RIGHT); } WDecoEnum::WDecoEnum(WGuiBase * _it, EnumDefinition *_edef) : WGuiDeco(_it) {edef = _edef;} @@ -1163,10 +1163,10 @@ void WGuiTabMenu::Render(){ int offset = 0; for(vector::iterator it = items.begin();it!=items.end();it++){ - int w = mFont->GetStringWidth((*it)->getDisplay().c_str()); + int w = mFont->GetStringWidth(_((*it)->getDisplay()).c_str()); mFont->SetColor((*it)->getColor(WGuiColor::TEXT_TAB)); renderer->FillRoundRect(offset+5,5,w + 5,25,2,(*it)->getColor(WGuiColor::BACK_TAB)); - mFont->DrawString((*it)->getDisplay().c_str(),offset+10,10); + mFont->DrawString(_((*it)->getDisplay()).c_str(),offset+10,10); offset += w + 10 + 2; } diff --git a/projects/mtg/src/SimpleMenu.cpp b/projects/mtg/src/SimpleMenu.cpp index 61aaddf58..ce72d6369 100644 --- a/projects/mtg/src/SimpleMenu.cpp +++ b/projects/mtg/src/SimpleMenu.cpp @@ -28,6 +28,7 @@ PIXEL_TYPE SimpleMenu::jewelGraphics[9] = {0x3FFFFFFF,0x63645AEA,0x610D0D98, SimpleMenu::SimpleMenu(int id, JGuiListener* listener, JLBFont* font, int x, int y, const char * _title, int _maxItems): JGuiController(id, listener){ + autoTranslate = true; mHeight = 2 * VMARGIN; mWidth = 0; mX = x; @@ -166,7 +167,7 @@ void SimpleMenu::Update(float dt){ } void SimpleMenu::Add(int id, const char * text,string desc, bool forceFocus){ - SimpleMenuItem * smi = NEW SimpleMenuItem(this, id, mFont, text, 0, mY + VMARGIN + mCount*LINE_HEIGHT, (mCount == 0)); + SimpleMenuItem * smi = NEW SimpleMenuItem(this, id, mFont, text, 0, mY + VMARGIN + mCount*LINE_HEIGHT, (mCount == 0),autoTranslate); smi->desc = desc; JGuiController::Add(smi); if (mCount <= maxItems) mHeight += LINE_HEIGHT; diff --git a/projects/mtg/src/SimpleMenuItem.cpp b/projects/mtg/src/SimpleMenuItem.cpp index 67c12996e..846f8142b 100644 --- a/projects/mtg/src/SimpleMenuItem.cpp +++ b/projects/mtg/src/SimpleMenuItem.cpp @@ -2,9 +2,10 @@ #include "../include/SimpleMenuItem.h" #include "../include/Translate.h" -SimpleMenuItem::SimpleMenuItem(SimpleMenu* _parent, int id, JLBFont *font, string text, int x, int y, bool hasFocus): JGuiObject(id), parent(_parent), mFont(font), mX(x), mY(y) +SimpleMenuItem::SimpleMenuItem(SimpleMenu* _parent, int id, JLBFont *font, string text, int x, int y, bool hasFocus, bool autoTranslate): JGuiObject(id), parent(_parent), mFont(font), mX(x), mY(y) { - mText = _(text); + if (autoTranslate) mText = _(text); + else mText = text; mHasFocus = hasFocus; mScale = 1.0f; diff --git a/projects/mtg/src/Translate.cpp b/projects/mtg/src/Translate.cpp index 2ba62252e..b8a79ac0b 100644 --- a/projects/mtg/src/Translate.cpp +++ b/projects/mtg/src/Translate.cpp @@ -1,5 +1,5 @@ -#include "../include/Translate.h" -#include "../include/config.h" +#include "../include/Translate.h" +#include "../include/config.h" #include #include #include @@ -23,14 +23,43 @@ int Translator::Add(string from, string to){ string Translator::translate(string value){ map::iterator it = values.find(value); if (it != values.end()) return it->second; +#if defined DEBUG_TRANSLATE + if (checkMisses){ + map::iterator it2 = dontCareValues.find(value); + if (it2 == dontCareValues.end()) + missingValues[value] = 1; + } +#endif return value; } + +Translator::~Translator(){ +#if defined DEBUG_TRANSLATE + if (!checkMisses) return; + std::ofstream file("Res/lang/missing.txt"); + char writer[4096]; + if (file){ + map::iterator it; + for (it = missingValues.begin(); it!=missingValues.end(); it++){ + sprintf(writer,"%s=\n", it->first.c_str()); + file<translate(toTranslate); } -string _(string toTranslate){ - Translator * t = Translator::GetInstance(); - return t->translate(toTranslate); -} -