- Fixed a few tranlsation issues in the code
- Updated French translation
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-10-31 07:58:21 +00:00
parent 41012eecde
commit 01c949f881
12 changed files with 279 additions and 82 deletions
+56
View File
@@ -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=
+110 -31
View File
@@ -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 # 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 #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 #Game menus/texts
LOADING SET: %s=CHARGEMENT SET: %s LOADING SET: %s=CHARGEMENT SET: %s
@@ -130,7 +207,7 @@ Display collection=Afficher collection
Your Deck: %i cards=Votre Deck: %i cartes Your Deck: %i cards=Votre Deck: %i cartes
You are currently viewing your=Vous etes sur votre You are currently viewing your=Vous etes sur votre
collection. Press TRIANGLE=collection. Appuyez sur TRIANGLE 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 deck. Press TRIANGLE to=deck. Appuyez sur TRIANGLE
switch to your collection=pour voir votre collection switch to your collection=pour voir votre collection
Your Deck: %i cards=votre deck: %i cartes Your Deck: %i cards=votre deck: %i cartes
@@ -139,39 +216,41 @@ No Card=Pas de carte
Deck info=Info deck Deck info=Info deck
Sell card=Vendre carte Sell card=Vendre carte
#types #types
artifact=artefact Artifact=artefact
enchantment=enchantement Creature=Creature
sorcery=rituel Enchantment=enchantement
instant=ephemere Sorcery=rituel
land=terrain Instant=ephemere
Land=terrain
#subtypes #subtypes
#please keep the english alphabetical order, makes it easier to update! #please keep the english alphabetical order, makes it easier to update!
angel=ange Angel=Ange
basic=basique Basic=Basique
bird=oiseau Bird=Oiseau
cat=chat Cat=Chat
centaur=centaure Centaur=Centaure
elf=elfe Elf=Elfe
forest=foret Forest=Foret
goblin=gobelin Goblin=Gobelin
hound=chien Hound=Chien
human=humain Human=Humain
island=ile Island=Ile
knight=chevalier Knight=Chevalier
minotaur=minotaure Minotaur=Minotaure
mountain=montagne Mountain=Montagne
plains=plaine Plains=Plaine
sliver=slivoide Sliver=Slivoide
sorcerer=sorcier Sorcerer=Sorcier
soldier=soldat Soldier=Soldat
specter=spectre Specter=Spectre
spider=araignee Spider=Araignee
swamp=marais Swamp=Marais
wall=mur Wall=Mur
warrior=guerrier Wolf=Loup
wolf=loup Wurm=Guivre
wurm=guivre Warrior=Guerrier
Archer=Archer
#card names #card names
+1
View File
@@ -39,6 +39,7 @@ class SimpleMenu:public JGuiController{
void drawVertPole(int x, int y, int height); void drawVertPole(int x, int y, int height);
public: public:
bool autoTranslate;
SimpleMenu(int id, JGuiListener* listener, JLBFont* font, int x, int y, const char * _title = "", int _maxItems = 7); SimpleMenu(int id, JGuiListener* listener, JLBFont* font, int x, int y, const char * _title = "", int _maxItems = 7);
void Render(); void Render();
void Update(float dt); void Update(float dt);
+1 -1
View File
@@ -25,7 +25,7 @@ class SimpleMenuItem: public JGuiObject
public: public:
string desc; 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 mX;
int mY; int mY;
+31 -20
View File
@@ -1,23 +1,34 @@
#ifndef _TRANSLATE_H_ #ifndef _TRANSLATE_H_
#define _TRANSLATE_H_ #define _TRANSLATE_H_
#include <string> #include <string>
#include <map> #include <map>
using namespace std;
#if defined WIN32
class Translator{ #define DEBUG_TRANSLATE
#endif
using namespace std;
class Translator{
protected: protected:
static Translator * mInstance; static Translator * mInstance;
public: public:
map<string,string> values; map<string,string> values;
string translate(string toTranslate); #if defined DEBUG_TRANSLATE
Translator(); map<string,int> missingValues;
int Add(string from, string to); map<string,int> dontCareValues;
int checkMisses;
#endif
string translate(string toTranslate);
Translator();
~Translator();
int Add(string from, string to);
static Translator * GetInstance(); static Translator * GetInstance();
static void EndInstance(); static void EndInstance();
}; };
string _(string toTranslate); string _(string toTranslate);
#endif #endif
+1
View File
@@ -9,6 +9,7 @@
int GameState::fillDeckMenu(SimpleMenu * _menu, string path, string smallDeckPrefix, Player * statsPlayer){ int GameState::fillDeckMenu(SimpleMenu * _menu, string path, string smallDeckPrefix, Player * statsPlayer){
int found = 1; int found = 1;
int nbDecks = 0; int nbDecks = 0;
_menu->autoTranslate = false;
while (found){ while (found){
found = 0; found = 0;
char buffer[512]; char buffer[512];
+1 -1
View File
@@ -11,7 +11,7 @@
#include "../include/utils.h" #include "../include/utils.h"
#include "../include/DeckDataWrapper.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 DEFAULT_ANGLE_MULTIPLIER 0.4
#define MAX_ANGLE_MULTIPLIER (3*M_PI) #define MAX_ANGLE_MULTIPLIER (3*M_PI)
+1 -1
View File
@@ -165,7 +165,7 @@ void GameStateOptions::Render()
for (int i = 0; i < size; i++){ for (int i = 0; i < size; i++){
pos = startpos +20*i; pos = startpos +20*i;
if (pos > -20){ 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);
} }
} }
+18 -18
View File
@@ -44,7 +44,7 @@ void WGuiItem::Render(){
mFont->SetColor(getColor(WGuiColor::TEXT)); mFont->SetColor(getColor(WGuiColor::TEXT));
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
float fH = (height-mFont->GetHeight())/2; 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){ WGuiItem::WGuiItem(string _display){
@@ -67,7 +67,7 @@ void WGuiHeader::Render(){
mFont->SetColor(getColor(WGuiColor::TEXT)); mFont->SetColor(getColor(WGuiColor::TEXT));
JRenderer * renderer = JRenderer::GetInstance(); 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 //WGuiText
@@ -77,7 +77,7 @@ void WGuiText::Render(){
mFont->SetColor(getColor(WGuiColor::TEXT_BODY)); mFont->SetColor(getColor(WGuiColor::TEXT_BODY));
JRenderer * renderer = JRenderer::GetInstance(); 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); mFont->SetScale(1);
} }
@@ -93,7 +93,7 @@ void OptionInteger::Render(){
mFont->SetColor(getColor(WGuiColor::TEXT)); mFont->SetColor(getColor(WGuiColor::TEXT));
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
mFont->DrawString(displayValue.c_str(),x,y); mFont->DrawString(_(displayValue).c_str(),x,y);
char buf[512]; char buf[512];
if (maxValue == 1){ if (maxValue == 1){
if (value){ if (value){
@@ -103,7 +103,7 @@ void OptionInteger::Render(){
} }
}else{ }else{
if(value == defValue && strDefault.size()) if(value == defValue && strDefault.size())
sprintf(buf, "%s", strDefault.c_str()); sprintf(buf, "%s", _(strDefault).c_str());
else else
sprintf(buf, "%i", value); sprintf(buf, "%i", value);
} }
@@ -144,12 +144,12 @@ void OptionSelect::Render(){
mFont->SetColor(getColor(WGuiColor::TEXT)); mFont->SetColor(getColor(WGuiColor::TEXT));
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
mFont->DrawString(displayValue.c_str(),x,y); mFont->DrawString(_(displayValue).c_str(),x,y);
if (value < selections.size()) 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 else
mFont->DrawString("Unset",x+width-10,y,JGETEXT_RIGHT); mFont->DrawString(_("Unset").c_str(),x+width-10,y,JGETEXT_RIGHT);
} }
void OptionSelect::setData(){ void OptionSelect::setData(){
@@ -433,7 +433,7 @@ void WGuiList::Render(){
if (!nbitems && failMsg != ""){ if (!nbitems && failMsg != ""){
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT); JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
mFont->SetColor(getColor(WGuiColor::TEXT_FAIL)); 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; return;
} }
@@ -617,12 +617,12 @@ void OptionString::Render(){
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
if(!bShowValue){ 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{ else{
mFont->DrawString(displayValue.c_str(),x,y); mFont->DrawString(_(displayValue).c_str(),x,y);
int w = mFont->GetStringWidth(value.c_str()-10); 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(); file.close();
} }
} }
sprintf(buf,"Theme: %s",selections[value].c_str()); sprintf(buf,_("Theme: %s").c_str(),selections[value].c_str());
if(q){ if(q){
float scale = 128 / q->mHeight; float scale = 128 / q->mHeight;
@@ -704,7 +704,7 @@ void OptionTheme::Render(){
mFont->SetColor(getColor(WGuiColor::TEXT_BODY)); mFont->SetColor(getColor(WGuiColor::TEXT_BODY));
mFont->SetScale(.8); mFont->SetScale(.8);
float hi = mFont->GetHeight(); 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->DrawString(buf,x,y+getHeight()-hi);
mFont->SetScale(1); mFont->SetScale(1);
} }
@@ -754,10 +754,10 @@ void WDecoEnum::Render()
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT); JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
mFont->SetColor(getColor(WGuiColor::TEXT)); mFont->SetColor(getColor(WGuiColor::TEXT));
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
mFont->DrawString(getDisplay().c_str(),getX(),getY()); mFont->DrawString(_(getDisplay()).c_str(),getX(),getY());
OptionInteger* opt = dynamic_cast<OptionInteger*>(it); OptionInteger* opt = dynamic_cast<OptionInteger*>(it);
if(opt) 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;} WDecoEnum::WDecoEnum(WGuiBase * _it, EnumDefinition *_edef) : WGuiDeco(_it) {edef = _edef;}
@@ -1163,10 +1163,10 @@ void WGuiTabMenu::Render(){
int offset = 0; int offset = 0;
for(vector<WGuiBase*>::iterator it = items.begin();it!=items.end();it++){ for(vector<WGuiBase*>::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)); mFont->SetColor((*it)->getColor(WGuiColor::TEXT_TAB));
renderer->FillRoundRect(offset+5,5,w + 5,25,2,(*it)->getColor(WGuiColor::BACK_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; offset += w + 10 + 2;
} }
+2 -1
View File
@@ -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){ 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; mHeight = 2 * VMARGIN;
mWidth = 0; mWidth = 0;
mX = x; mX = x;
@@ -166,7 +167,7 @@ void SimpleMenu::Update(float dt){
} }
void SimpleMenu::Add(int id, const char * text,string desc, bool forceFocus){ 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; smi->desc = desc;
JGuiController::Add(smi); JGuiController::Add(smi);
if (mCount <= maxItems) mHeight += LINE_HEIGHT; if (mCount <= maxItems) mHeight += LINE_HEIGHT;
+3 -2
View File
@@ -2,9 +2,10 @@
#include "../include/SimpleMenuItem.h" #include "../include/SimpleMenuItem.h"
#include "../include/Translate.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; mHasFocus = hasFocus;
mScale = 1.0f; mScale = 1.0f;
+54 -7
View File
@@ -1,5 +1,5 @@
#include "../include/Translate.h" #include "../include/Translate.h"
#include "../include/config.h" #include "../include/config.h"
#include <JGE.h> #include <JGE.h>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
@@ -23,14 +23,43 @@ int Translator::Add(string from, string to){
string Translator::translate(string value){ string Translator::translate(string value){
map<string,string>::iterator it = values.find(value); map<string,string>::iterator it = values.find(value);
if (it != values.end()) return it->second; if (it != values.end()) return it->second;
#if defined DEBUG_TRANSLATE
if (checkMisses){
map<string,int>::iterator it2 = dontCareValues.find(value);
if (it2 == dontCareValues.end())
missingValues[value] = 1;
}
#endif
return value; return value;
} }
Translator::~Translator(){
#if defined DEBUG_TRANSLATE
if (!checkMisses) return;
std::ofstream file("Res/lang/missing.txt");
char writer[4096];
if (file){
map<string,int>::iterator it;
for (it = missingValues.begin(); it!=missingValues.end(); it++){
sprintf(writer,"%s=\n", it->first.c_str());
file<<writer;
}
file.close();
}
#endif
}
Translator::Translator(){ Translator::Translator(){
#if defined DEBUG_TRANSLATE
checkMisses = 0;
#endif
std::ifstream file("Res/lang/_lang.txt"); std::ifstream file("Res/lang/_lang.txt");
std::string s; std::string s;
if(file){ if(file){
#if defined DEBUG_TRANSLATE
checkMisses = 1;
#endif
while(std::getline(file,s)){ while(std::getline(file,s)){
if (!s.size()) continue; if (!s.size()) continue;
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
@@ -42,10 +71,28 @@ Translator::Translator(){
} }
file.close(); file.close();
} }
#if defined DEBUG_TRANSLATE
if (!checkMisses) return;
std::ifstream file2("Res/lang/dontcare.txt");
if(file2){
while(std::getline(file2,s)){
if (!s.size()) continue;
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
size_t found = s.find('=');
if (found != string::npos)
s = s.substr(0,found);
dontCareValues[s] = 1;
}
file2.close();
}
#endif
}
string _(string toTranslate){
Translator * t = Translator::GetInstance();
return t->translate(toTranslate);
} }
string _(string toTranslate){
Translator * t = Translator::GetInstance();
return t->translate(toTranslate);
}