- 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

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=

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
#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

View File

@@ -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);

View File

@@ -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;

View File

@@ -1,23 +1,34 @@
#ifndef _TRANSLATE_H_
#define _TRANSLATE_H_
#include <string>
#include <map>
using namespace std;
class Translator{
#ifndef _TRANSLATE_H_
#define _TRANSLATE_H_
#include <string>
#include <map>
#if defined WIN32
#define DEBUG_TRANSLATE
#endif
using namespace std;
class Translator{
protected:
static Translator * mInstance;
public:
map<string,string> values;
string translate(string toTranslate);
Translator();
int Add(string from, string to);
static Translator * mInstance;
public:
map<string,string> values;
#if defined DEBUG_TRANSLATE
map<string,int> missingValues;
map<string,int> 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

View File

@@ -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];

View File

@@ -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)

View File

@@ -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);
}
}

View File

@@ -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<OptionInteger*>(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<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));
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;
}

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){
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;

View File

@@ -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;

View File

@@ -1,5 +1,5 @@
#include "../include/Translate.h"
#include "../include/config.h"
#include "../include/Translate.h"
#include "../include/config.h"
#include <JGE.h>
#include <fstream>
#include <iostream>
@@ -23,14 +23,43 @@ int Translator::Add(string from, string to){
string Translator::translate(string value){
map<string,string>::iterator it = values.find(value);
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;
}
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(){
#if defined DEBUG_TRANSLATE
checkMisses = 0;
#endif
std::ifstream file("Res/lang/_lang.txt");
std::string s;
if(file){
#if defined DEBUG_TRANSLATE
checkMisses = 1;
#endif
while(std::getline(file,s)){
if (!s.size()) continue;
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
@@ -42,10 +71,28 @@ Translator::Translator(){
}
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);
}