diff options
-rw-r--r-- | po/POTFILES.in | 9 | ||||
-rw-r--r-- | src/gui/buysell.cpp | 10 | ||||
-rw-r--r-- | src/gui/chat.cpp | 172 | ||||
-rw-r--r-- | src/gui/help.cpp | 6 | ||||
-rw-r--r-- | src/gui/setup_keyboard.cpp | 12 | ||||
-rw-r--r-- | src/gui/setup_players.cpp | 60 | ||||
-rw-r--r-- | src/gui/skill.cpp | 35 | ||||
-rw-r--r-- | src/gui/status.cpp | 88 | ||||
-rw-r--r-- | src/gui/trade.cpp | 4 | ||||
-rw-r--r-- | src/gui/updatewindow.cpp | 11 | ||||
-rw-r--r-- | src/main.cpp | 13 |
11 files changed, 235 insertions, 185 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in index f750976e..4207012b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,11 +1,14 @@ # List of source files which contain translatable strings. src/gui/buy.cpp +src/gui/buysell.cpp src/gui/char_select.cpp src/gui/char_server.cpp +src/gui/chat.cpp src/gui/confirm_dialog.cpp src/gui/connection.cpp src/gui/equipmentwindow.cpp +src/gui/help.cpp src/gui/inventorywindow.cpp src/gui/item_amount.cpp src/gui/login.cpp @@ -20,6 +23,12 @@ src/gui/sell.cpp src/gui/setup_audio.cpp src/gui/setup.cpp src/gui/setup_joystick.cpp +src/gui/setup_keyboard.cpp +src/gui/setup_players.cpp src/gui/setup_video.cpp +src/gui/skill.cpp +src/gui/status.cpp src/gui/trade.cpp +src/gui/updatewindow.cpp src/resources/itemdb.cpp +src/main.cpp diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index 42380882..a8223ca4 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -25,18 +25,20 @@ #include "../npc.h" +#include "../utils/gettext.h" + BuySellDialog::BuySellDialog(): - Window("Shop") + Window(_("Shop")) { Button *buyButton = 0; - const char *buttonNames[] = { - "Buy", "Sell", "Cancel", 0 + static const char *buttonNames[] = { + N_("Buy"), N_("Sell"), N_("Cancel"), 0 }; int x = 10, y = 10; for (const char **curBtn = buttonNames; *curBtn; curBtn++) { - Button *btn = new Button(*curBtn, *curBtn, this); + Button *btn = new Button(gettext(*curBtn), *curBtn, this); if (!buyButton) buyButton = btn; // For focus request btn->setPosition(x, y); add(btn); diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 3c02e656..d61ec021 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -39,6 +39,8 @@ #include "../net/messageout.h" #include "../net/protocol.h" +#include "../utils/gettext.h" +#include "../utils/strprintf.h" #include "../utils/trim.h" ChatWindow::ChatWindow(Network *network): @@ -116,11 +118,14 @@ void ChatWindow::chatLog(std::string line, int own) std::string lineColor = "##0"; // Equiv. to BrowserBox::BLACK switch (own) { case BY_GM: - if (tmp.nick.empty()) - tmp.nick = std::string("Global announcement: "); - else - tmp.nick = std::string("Global announcement from " + tmp.nick - + std::string(": ")); + if (tmp.nick.empty()) { + tmp.nick = _("Global announcement:"); + tmp.nick += " "; + } else { + tmp.nick = strprintf(_("Global announcement from %s:"), + tmp.nick.c_str()); + tmp.nick += " "; + } lineColor = "##1"; // Equiv. to BrowserBox::RED break; case BY_PLAYER: @@ -132,12 +137,14 @@ void ChatWindow::chatLog(std::string line, int own) lineColor = "##0"; // Equiv. to BrowserBox::BLACK break; case BY_SERVER: - tmp.nick = "Server: "; + tmp.nick = _("Server:"); + tmp.nick += " "; tmp.text = line; lineColor = "##7"; // Equiv. to BrowserBox::PINK break; case ACT_WHISPER: - tmp.nick += CAT_WHISPER; + tmp.nick = strprintf(_("%s whispers:"), tmp.nick.c_str()); + tmp.nick += " "; lineColor = "##3"; // Equiv. to BrowserBox::BLUE break; case ACT_IS: @@ -250,7 +257,7 @@ void ChatWindow::whisper(const std::string &nick, std::string msg, std::string recvnick = ""; msg.erase(0, prefixlen + 1); - if (msg.substr(0,1) == "\"") + if (msg.substr(0, 1) == "\"") { const std::string::size_type pos = msg.find('"', 1); if (pos != std::string::npos) { @@ -273,7 +280,9 @@ void ChatWindow::whisper(const std::string &nick, std::string msg, outMsg.writeString(recvnick, 24); outMsg.writeString(msg, msg.length()); - chatLog("Whispering to " + recvnick + " : " + msg, BY_PLAYER); + chatLog(strprintf(_("Whispering to %s: %s"), + recvnick.c_str(), msg.c_str()), + BY_PLAYER); } void ChatWindow::chatSend(const std::string &nick, std::string msg) @@ -344,7 +353,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) whisper(nick, msg, IS_SHORT_WHISPER_LENGTH); else { - chatLog("Unknown command", BY_SERVER); + chatLog(_("Unknown command"), BY_SERVER); } } @@ -353,71 +362,73 @@ std::string ChatWindow::const_msg(CHATSKILL act) std::string msg; if (act.success == SKILL_FAILED && act.skill == SKILL_BASIC) { switch (act.bskill) { - case BSKILL_TRADE : - msg = "Trade failed!"; + case BSKILL_TRADE: + msg = _("Trade failed!"); break; - case BSKILL_EMOTE : - msg = "Emote failed!"; + case BSKILL_EMOTE: + msg = _("Emote failed!"); break; - case BSKILL_SIT : - msg = "Sit failed!"; + case BSKILL_SIT: + msg = _("Sit failed!"); break; - case BSKILL_CREATECHAT : - msg = "Chat creating failed!"; + case BSKILL_CREATECHAT: + msg = _("Chat creating failed!"); break; - case BSKILL_JOINPARTY : - msg = "Could not join party!"; + case BSKILL_JOINPARTY: + msg = _("Could not join party!"); break; - case BSKILL_SHOUT : - msg = "Cannot shout!"; + case BSKILL_SHOUT: + msg = _("Cannot shout!"); break; } + msg += " "; + switch (act.reason) { - case RFAIL_SKILLDEP : - msg += " You have not yet reached a high enough lvl!"; + case RFAIL_SKILLDEP: + msg += _("You have not yet reached a high enough lvl!"); break; - case RFAIL_INSUFHP : - msg += " Insufficient HP!"; + case RFAIL_INSUFHP: + msg += _("Insufficient HP!"); break; - case RFAIL_INSUFSP : - msg += " Insufficient SP!"; + case RFAIL_INSUFSP: + msg += _("Insufficient SP!"); break; - case RFAIL_NOMEMO : - msg += " You have no memos!"; + case RFAIL_NOMEMO: + msg += _("You have no memos!"); break; - case RFAIL_SKILLDELAY : - msg += " You cannot do that right now!"; + case RFAIL_SKILLDELAY: + msg += _("You cannot do that right now!"); break; - case RFAIL_ZENY : - msg += " Seems you need more Zeny... ;-)"; + case RFAIL_ZENY: + msg += _("Seems you need more Zeny... ;-)"); break; - case RFAIL_WEAPON : - msg += " You cannot use this skill with that kind of weapon!"; + case RFAIL_WEAPON: + msg += _("You cannot use this skill with that kind of weapon!"); break; - case RFAIL_REDGEM : - msg += " You need another red gem!"; + case RFAIL_REDGEM: + msg += _("You need another red gem!"); break; - case RFAIL_BLUEGEM : - msg += " You need another blue gem!"; + case RFAIL_BLUEGEM: + msg += _("You need another blue gem!"); break; - case RFAIL_OVERWEIGHT : - msg += " You're carrying to much to do this!"; + case RFAIL_OVERWEIGHT: + msg += _("You're carrying to much to do this!"); break; - default : - msg += " Huh? What's that?"; + default: + msg += _("Huh? What's that?"); break; } } else { - switch(act.skill) { + switch (act.skill) { case SKILL_WARP : - msg = "Warp failed..."; + msg = _("Warp failed..."); break; case SKILL_STEAL : - msg = "Could not steal anything..."; + msg = _("Could not steal anything..."); break; case SKILL_ENVENOM : - msg = "Poison had no effect..."; + msg = _("Poison had no effect..."); break; } } @@ -482,67 +493,68 @@ void ChatWindow::setVisible(bool isVisible) void ChatWindow::help(const std::string &msg1, const std::string &msg2) { - chatLog("-- Help --", BY_SERVER); + chatLog(_("-- Help --"), BY_SERVER); if (msg1 == "") { - chatLog("/announce: Global announcement (GM only)", BY_SERVER); - chatLog("/clear: Clears this window", BY_SERVER); - chatLog("/help: Display this help.", BY_SERVER); - chatLog("/where: Display map name", BY_SERVER); - chatLog("/whisper <nick> <message>: Sends a private <message>" - " to <nick>", BY_SERVER); - chatLog("/w <nick> <message>: Short form for /whisper", BY_SERVER); - chatLog("/who: Display number of online users", BY_SERVER); - chatLog("For more information, type /help <command>", BY_SERVER); + chatLog(_("/announce: Global announcement (GM only)"), BY_SERVER); + chatLog(_("/clear: Clears this window"), BY_SERVER); + chatLog(_("/help: Display this help"), BY_SERVER); + chatLog(_("/where: Display map name"), BY_SERVER); + chatLog(_("/whisper <nick> <message>: Sends a private <message>" + " to <nick>"), BY_SERVER); + chatLog(_("/w <nick> <message>: Short form for /whisper"), BY_SERVER); + chatLog(_("/who: Display number of online users"), BY_SERVER); + chatLog(_("For more information, type /help <command>"), BY_SERVER); return; } if (msg1 == "announce") { - chatLog("Command: /announce <msg>", BY_SERVER); - chatLog("*** only available to a GM ***", BY_SERVER); - chatLog("This command sends the message <msg> to " - "all players currently online.", BY_SERVER); + chatLog(_("Command: /announce <msg>"), BY_SERVER); + chatLog(_("*** only available to a GM ***"), BY_SERVER); + chatLog(_("This command sends the message <msg> to " + "all players currently online."), BY_SERVER); return; } if (msg1 == "clear") { - chatLog("Command: /clear", BY_SERVER); - chatLog("This command clears the chat log of previous chat.", + chatLog(_("Command: /clear"), BY_SERVER); + chatLog(_("This command clears the chat log of previous chat."), BY_SERVER); return; } if (msg1 == "help") { - chatLog("Command: /help", BY_SERVER); - chatLog("This command displays a list of all commands available.", + chatLog(_("Command: /help"), BY_SERVER); + chatLog(_("This command displays a list of all commands available."), BY_SERVER); - chatLog("Command: /help <command>", BY_SERVER); - chatLog("This command displays help on <command>.", BY_SERVER); + chatLog(_("Command: /help <command>"), BY_SERVER); + chatLog(_("This command displays help on <command>."), BY_SERVER); return; } if (msg1 == "where") { - chatLog("Command: /where", BY_SERVER); - chatLog("This command displays the name of the current map.", + chatLog(_("Command: /where"), BY_SERVER); + chatLog(_("This command displays the name of the current map."), BY_SERVER); return; } if (msg1 == "whisper" || msg1 == "w") { - chatLog("Command: /whisper <nick> <msg>", BY_SERVER); - chatLog("Command: /w <nick> <msg>", BY_SERVER); - chatLog("This command sends the message <msg> to <nick>.", BY_SERVER); - chatLog("If the <nick> has spaces in it, enclose it in " - "double quotes (\").", BY_SERVER); + chatLog(_("Command: /whisper <nick> <msg>"), BY_SERVER); + chatLog(_("Command: /w <nick> <msg>"), BY_SERVER); + chatLog(_("This command sends the message <msg> to <nick>."), + BY_SERVER); + chatLog(_("If the <nick> has spaces in it, enclose it in " + "double quotes (\")."), BY_SERVER); return; } if (msg1 == "who") { - chatLog("Command: /who", BY_SERVER); - chatLog("This command displays the number of players currently " - "online.", BY_SERVER); + chatLog(_("Command: /who"), BY_SERVER); + chatLog(_("This command displays the number of players currently " + "online."), BY_SERVER); return; } - chatLog("Unknown command.", BY_SERVER); - chatLog("Type /help for a list of commands.", BY_SERVER); + chatLog(_("Unknown command."), BY_SERVER); + chatLog(_("Type /help for a list of commands."), BY_SERVER); } diff --git a/src/gui/help.cpp b/src/gui/help.cpp index 290679b9..a52119b8 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -27,8 +27,10 @@ #include "../resources/resourcemanager.h" +#include "../utils/gettext.h" + HelpWindow::HelpWindow(): - Window("Help") + Window(_("Help")) { setContentSize(455, 350); setWindowName("Help"); @@ -36,7 +38,7 @@ HelpWindow::HelpWindow(): mBrowserBox = new BrowserBox(); mBrowserBox->setOpaque(false); mScrollArea = new ScrollArea(mBrowserBox); - Button *okButton = new Button("Close", "close", this); + Button *okButton = new Button(_("Close"), "close", this); mScrollArea->setDimension(gcn::Rectangle( 5, 5, 445, 335 - okButton->getHeight())); diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp index c6247487..de3c0ce1 100644 --- a/src/gui/setup_keyboard.cpp +++ b/src/gui/setup_keyboard.cpp @@ -32,6 +32,7 @@ #include "../configuration.h" #include "../keyboardconfig.h" +#include "../utils/gettext.h" #include "../utils/tostring.h" #include <SDL_keyboard.h> @@ -84,13 +85,13 @@ Setup_Keyboard::Setup_Keyboard(): scrollArea->setDimension(gcn::Rectangle(10, 10, 200, 140)); add(scrollArea); - mAssignKeyButton = new Button("Assign", "assign", this); + mAssignKeyButton = new Button(_("Assign"), "assign", this); mAssignKeyButton->setPosition(165, 155); mAssignKeyButton->addActionListener(this); mAssignKeyButton->setEnabled(false); add(mAssignKeyButton); - mMakeDefaultButton = new Button("Default", "makeDefault", this); + mMakeDefaultButton = new Button(_("Default"), "makeDefault", this); mMakeDefaultButton->setPosition(10, 155); mMakeDefaultButton->addActionListener(this); add(mMakeDefaultButton); @@ -111,8 +112,9 @@ void Setup_Keyboard::apply() if (keyboard.hasConflicts()) { - new OkDialog("Key Conflict(s) Detected.", - "Resolve them, or gameplay may result in strange behaviour."); + new OkDialog(_("Key Conflict(s) Detected."), + _("Resolve them, or gameplay may result in strange " + "behaviour.")); } keyboard.setEnabled(true); keyboard.store(); @@ -170,7 +172,7 @@ void Setup_Keyboard::newKeyCallback(int index) void Setup_Keyboard::refreshKeys() { - for(int i = 0; i < keyboard.KEY_TOTAL; i++) + for (int i = 0; i < keyboard.KEY_TOTAL; i++) { refreshAssignedKey(i); } diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index c556a82d..122f54e1 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -30,6 +30,8 @@ #include "../log.h" #include "../sound.h" +#include "../utils/gettext.h" + #include <guichan/widgets/dropdown.hpp> #include <guichan/widgets/label.hpp> @@ -47,10 +49,16 @@ #define WIDGET_AT(row, column) (((row) * COLUMNS_NR) + column) -static std::string table_titles[COLUMNS_NR] = {"name", "relation"}; +static const char *table_titles[COLUMNS_NR] = { + N_("Name"), + N_("Relation") +}; -static const std::string RELATION_NAMES[PlayerRelation::RELATIONS_NR] = { - "neutral", "friend", "disregarded", "ignored" +static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] = { + N_("Neutral"), + N_("Friend"), + N_("Disregarded"), + N_("Ignored") }; class PlayerRelationListModel : public gcn::ListModel @@ -67,7 +75,7 @@ public: { if (i >= getNumberOfElements() || i < 0) return ""; - return RELATION_NAMES[i]; + return gettext(RELATION_NAMES[i]); } }; @@ -136,7 +144,8 @@ public: virtual void updateModelInRow(int row) { - gcn::DropDown *choicebox = dynamic_cast<gcn::DropDown *>(getElementAt(row, RELATION_CHOICE_COLUMN)); + gcn::DropDown *choicebox = dynamic_cast<gcn::DropDown *>( + getElementAt(row, RELATION_CHOICE_COLUMN)); player_relations.setRelation(getPlayerAt(row), static_cast<PlayerRelation::relation>(choicebox->getSelected())); } @@ -202,21 +211,27 @@ Setup_Players::Setup_Players(): mPlayerTable(new GuiTable(mPlayerTableModel)), mPlayerTitleTable(new GuiTable(mPlayerTableTitleModel)), mPlayerScrollArea(new ScrollArea(mPlayerTable)), - mPersistIgnores(new CheckBox("save player list", player_relations.getPersistIgnores())), - mDefaultTrading(new CheckBox("allow trading", player_relations.getDefault() & PlayerRelation::TRADE)), - mDefaultWhisper(new CheckBox("allow whispers", player_relations.getDefault() & PlayerRelation::WHISPER)), - mDeleteButton(new Button("Delete", ACTION_DELETE, this)), + mPersistIgnores(new CheckBox(_("Save player list"), + player_relations.getPersistIgnores())), + mDefaultTrading(new CheckBox(_("Allow trading"), + player_relations.getDefault() & PlayerRelation::TRADE)), + mDefaultWhisper(new CheckBox(_("Allow whispers"), + player_relations.getDefault() & PlayerRelation::WHISPER)), + mDeleteButton(new Button(_("Delete"), ACTION_DELETE, this)), mIgnoreActionChoicesBox(new gcn::DropDown(new IgnoreChoicesListModel())) { setOpaque(false); int table_width = NAME_COLUMN_WIDTH + RELATION_CHOICE_COLUMN_WIDTH; mPlayerTableTitleModel->fixColumnWidth(NAME_COLUMN, NAME_COLUMN_WIDTH); - mPlayerTableTitleModel->fixColumnWidth(RELATION_CHOICE_COLUMN, RELATION_CHOICE_COLUMN_WIDTH); + mPlayerTableTitleModel->fixColumnWidth(RELATION_CHOICE_COLUMN, + RELATION_CHOICE_COLUMN_WIDTH); mPlayerTitleTable->setDimension(gcn::Rectangle(10, 10, table_width, 10)); mPlayerTitleTable->setBackgroundColor(gcn::Color(0xbf, 0xbf, 0xbf)); - for (int i = 0; i < COLUMNS_NR; i++) - mPlayerTableTitleModel->set(0, i, new gcn::Label(table_titles[i])); + for (int i = 0; i < COLUMNS_NR; i++) { + mPlayerTableTitleModel->set(0, i, + new gcn::Label(gettext(table_titles[i]))); + } mPlayerTitleTable->setLinewiseSelection(true); mPlayerScrollArea->setDimension(gcn::Rectangle(10, 25, table_width + COLUMNS_NR, 90)); @@ -227,7 +242,7 @@ Setup_Players::Setup_Players(): mDeleteButton->setPosition(10, 118); - gcn::Label *ignore_action_label = new gcn::Label("When ignoring:"); + gcn::Label *ignore_action_label = new gcn::Label(_("When ignoring:")); ignore_action_label->setPosition(80, 118); mIgnoreActionChoicesBox->setDimension(gcn::Rectangle(80, 132, 120, 12)); @@ -269,9 +284,9 @@ Setup_Players::~Setup_Players() void Setup_Players::reset() { - // We now have to search through the list of ignore choices to find the current - // selection. We could use an index into the table of config options in - // player_relations instead of strategies to sidestep this. + // We now have to search through the list of ignore choices to find the + // current selection. We could use an index into the table of config + // options in player_relations instead of strategies to sidestep this. int selection = 0; for (unsigned int i = 0; i < player_relations.getPlayerIgnoreStrategies()->size(); ++i) if ((*player_relations.getPlayerIgnoreStrategies())[i] == @@ -303,9 +318,10 @@ void Setup_Players::cancel() void Setup_Players::action(const gcn::ActionEvent &event) { if (event.getId() == ACTION_TABLE) { - // temporarily eliminate ourselves: we are fully aware of this change, so there is no - // need for asynchronous updates. (In fact, thouse might destroy the widet that - // triggered them, which would be rather embarrassing.) + // temporarily eliminate ourselves: we are fully aware of this change, + // so there is no need for asynchronous updates. (In fact, thouse + // might destroy the widet that triggered them, which would be rather + // embarrassing.) player_relations.removeListener(this); int row = mPlayerTable->getSelectedRow(); @@ -336,6 +352,8 @@ void Setup_Players::action(const gcn::ActionEvent &event) void Setup_Players::updatedPlayer(const std::string &name) { mPlayerTableModel->playerRelationsUpdated(); - mDefaultTrading->setSelected(player_relations.getDefault() & PlayerRelation::TRADE); - mDefaultWhisper->setSelected(player_relations.getDefault() & PlayerRelation::WHISPER); + mDefaultTrading->setSelected( + player_relations.getDefault() & PlayerRelation::TRADE); + mDefaultWhisper->setSelected( + player_relations.getDefault() & PlayerRelation::WHISPER); } diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 82108f84..8b8c58cd 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -29,12 +29,14 @@ #include "windowcontainer.h" #include "../localplayer.h" +#include "../log.h" #include "../utils/dtor.h" +#include "../utils/gettext.h" +#include "../utils/strprintf.h" #include "../utils/xml.h" -#include "../log.h" -#define SKILLS_FILE "skills.xml" +static const char *SKILLS_FILE = "skills.xml"; struct SkillInfo { std::string name; @@ -73,7 +75,10 @@ public: virtual void update() { - static const SkillInfo fakeSkillInfo = { "Mystery Skill", false }; + static const SkillInfo fakeSkillInfo = { + _("Mystery Skill"), + false + }; mEntriesNr = mDialog->getSkills().size(); resize(); @@ -90,13 +95,13 @@ public: info = &fakeSkillInfo; sprintf(tmp, "%c%s", info->modifiable? ' ' : '*', info->name.c_str()); - gcn::Label *name_label = new gcn::Label(std::string(tmp)); + gcn::Label *name_label = new gcn::Label(tmp); sprintf(tmp, "Lv:%i", skill->lv); - gcn::Label *lv_label = new gcn::Label(std::string(tmp)); + gcn::Label *lv_label = new gcn::Label(tmp); sprintf(tmp, "Sp:%i", skill->sp); - gcn::Label *sp_label = new gcn::Label(std::string(tmp)); + gcn::Label *sp_label = new gcn::Label(tmp); set(i, 0, name_label); set(i, 1, lv_label); @@ -111,7 +116,7 @@ private: SkillDialog::SkillDialog(): - Window("Skills") + Window(_("Skills")) { initSkillinfo(); mTableModel = new SkillGuiTableModel(this); @@ -124,9 +129,9 @@ SkillDialog::SkillDialog(): // mSkillListBox = new ListBox(this); ScrollArea *skillScrollArea = new ScrollArea(&mTable); - mPointsLabel = new gcn::Label("Skill Points:"); - mIncButton = new Button("Up", "inc", this); - mUseButton = new Button("Use", "use", this); + mPointsLabel = new gcn::Label(strprintf(_("Skill points: %d"), 0)); + mIncButton = new Button(_("Up"), "inc", this); + mUseButton = new Button(_("Use"), "use", this); mUseButton->setEnabled(false); // mSkillListBox->setActionEventId("skill"); @@ -180,11 +185,8 @@ void SkillDialog::action(const gcn::ActionEvent &event) void SkillDialog::update() { - if (mPointsLabel != NULL) { - char tmp[128]; - sprintf(tmp, "Skill points: %i", player_node->mSkillPoint); - mPointsLabel->setCaption(tmp); - } + mPointsLabel->setCaption(strprintf(_("Skill points: %d"), + player_node->mSkillPoint)); int selectedSkill = mTable.getSelectedRow(); @@ -254,8 +256,7 @@ static void initSkillinfo() if (!root || !xmlStrEqual(root->name, BAD_CAST "skills")) { - logger->log("Error loading skills file: " - SKILLS_FILE); + logger->log("Error loading skills file: %s", SKILLS_FILE); skill_db.resize(2, emptySkillInfo); skill_db[1].name = "Basic"; skill_db[1].modifiable = true; diff --git a/src/gui/status.cpp b/src/gui/status.cpp index 1a257ae8..a5bb77c3 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -29,6 +29,8 @@ #include "../localplayer.h" +#include "../utils/gettext.h" +#include "../utils/strprintf.h" #include "../utils/tostring.h" StatusWindow::StatusWindow(LocalPlayer *player): @@ -46,25 +48,25 @@ StatusWindow::StatusWindow(LocalPlayer *player): // Status Part // ---------------------- - mLvlLabel = new gcn::Label("Level:"); - mGpLabel = new gcn::Label("Money:"); - mJobLvlLabel = new gcn::Label("Job:"); + mLvlLabel = new gcn::Label(strprintf(_("Level: %d"), 0)); + mGpLabel = new gcn::Label(strprintf(_("Job: %d"), 0)); + mJobLvlLabel = new gcn::Label(strprintf(_("Money: %d GP"), 0)); mHpLabel = new gcn::Label("HP:"); mHpBar = new ProgressBar(1.0f, 80, 15, 0, 171, 34); - mHpValueLabel = new gcn::Label(""); + mHpValueLabel = new gcn::Label; mXpLabel = new gcn::Label("Exp:"); mXpBar = new ProgressBar(1.0f, 80, 15, 143, 192, 211); - mXpValueLabel = new gcn::Label(""); + mXpValueLabel = new gcn::Label; mMpLabel = new gcn::Label("MP:"); mMpBar = new ProgressBar(1.0f, 80, 15, 26, 102, 230); - mMpValueLabel = new gcn::Label(""); + mMpValueLabel = new gcn::Label; mJobXpLabel = new gcn::Label("Job:"); mJobXpBar = new ProgressBar(1.0f, 80, 15, 220, 135, 203); - mJobValueLabel = new gcn::Label(""); + mJobValueLabel = new gcn::Label; int y = 3; int x = 5; @@ -122,34 +124,34 @@ StatusWindow::StatusWindow(LocalPlayer *player): // ---------------------- // Static Labels - gcn::Label *mStatsTitleLabel = new gcn::Label("Stats"); - gcn::Label *mStatsTotalLabel = new gcn::Label("Total"); - gcn::Label *mStatsCostLabel = new gcn::Label("Cost"); + gcn::Label *mStatsTitleLabel = new gcn::Label(_("Stats")); + gcn::Label *mStatsTotalLabel = new gcn::Label(_("Total")); + gcn::Label *mStatsCostLabel = new gcn::Label(_("Cost")); // Derived Stats - mStatsAttackLabel = new gcn::Label("Attack:"); - mStatsDefenseLabel= new gcn::Label("Defense:"); - mStatsMagicAttackLabel = new gcn::Label("M.Attack:"); - mStatsMagicDefenseLabel = new gcn::Label("M.Defense:"); - mStatsAccuracyLabel = new gcn::Label("% Accuracy:"); - mStatsEvadeLabel = new gcn::Label("% Evade:"); - mStatsReflexLabel = new gcn::Label("% Reflex:"); - - mStatsAttackPoints = new gcn::Label(""); - mStatsDefensePoints = new gcn::Label(""); - mStatsMagicAttackPoints = new gcn::Label(""); - mStatsMagicDefensePoints = new gcn::Label(""); - mStatsAccuracyPoints = new gcn::Label("% Accuracy:"); - mStatsEvadePoints = new gcn::Label("% Evade:"); - mStatsReflexPoints = new gcn::Label("% Reflex:"); + mStatsAttackLabel = new gcn::Label(_("Attack:")); + mStatsDefenseLabel= new gcn::Label(_("Defense:")); + mStatsMagicAttackLabel = new gcn::Label(_("M.Attack:")); + mStatsMagicDefenseLabel = new gcn::Label(_("M.Defense:")); + mStatsAccuracyLabel = new gcn::Label(_("% Accuracy:")); + mStatsEvadeLabel = new gcn::Label(_("% Evade:")); + mStatsReflexLabel = new gcn::Label(_("% Reflex:")); + + mStatsAttackPoints = new gcn::Label; + mStatsDefensePoints = new gcn::Label; + mStatsMagicAttackPoints = new gcn::Label; + mStatsMagicDefensePoints = new gcn::Label; + mStatsAccuracyPoints = new gcn::Label; + mStatsEvadePoints = new gcn::Label; + mStatsReflexPoints = new gcn::Label; // New labels for (int i = 0; i < 6; i++) { - mStatsLabel[i] = new gcn::Label(); - mStatsDisplayLabel[i] = new gcn::Label(); + mStatsLabel[i] = new gcn::Label; + mStatsDisplayLabel[i] = new gcn::Label; mPointsLabel[i] = new gcn::Label("0"); } - mRemainingStatsPointsLabel = new gcn::Label(); + mRemainingStatsPointsLabel = new gcn::Label; // Set button events Id mStatsButton[0] = new Button("+", "STR", this); @@ -227,13 +229,13 @@ void StatusWindow::update() { // Status Part // ----------- - mLvlLabel->setCaption("Level: " + toString(mPlayer->mLevel)); + mLvlLabel->setCaption(strprintf(_("Level: %d"), mPlayer->mLevel)); mLvlLabel->adjustSize(); - mJobLvlLabel->setCaption("Job: " + toString(mPlayer->mJobLevel)); + mJobLvlLabel->setCaption(strprintf(_("Job: %d"), mPlayer->mJobLevel)); mJobLvlLabel->adjustSize(); - mGpLabel->setCaption("Money: " + toString(mPlayer->mGp) + " GP"); + mGpLabel->setCaption(strprintf(_("Money: %d GP"), mPlayer->mGp)); mGpLabel->adjustSize(); mHpValueLabel->setCaption(toString(mPlayer->mHp) + @@ -276,20 +278,20 @@ void StatusWindow::update() // Stats Part // ---------- - static const std::string attrNames[6] = { - "Strength", - "Agility", - "Vitality", - "Intelligence", - "Dexterity", - "Luck" + static const char *attrNames[6] = { + N_("Strength"), + N_("Agility"), + N_("Vitality"), + N_("Intelligence"), + N_("Dexterity"), + N_("Luck") }; int statusPoints = mPlayer->mStatsPointsToAttribute; // Update labels for (int i = 0; i < 6; i++) { - mStatsLabel[i]->setCaption(attrNames[i]); + mStatsLabel[i]->setCaption(gettext(attrNames[i])); mStatsDisplayLabel[i]->setCaption(toString((int) mPlayer->mAttr[i])); mPointsLabel[i]->setCaption(toString((int) mPlayer->mAttrUp[i])); @@ -299,8 +301,8 @@ void StatusWindow::update() mStatsButton[i]->setEnabled(mPlayer->mAttrUp[i] <= statusPoints); } - mRemainingStatsPointsLabel->setCaption("Remaining Status Points: " + - toString(statusPoints)); + mRemainingStatsPointsLabel->setCaption( + strprintf(_("Remaining Status Points: %d"), statusPoints)); mRemainingStatsPointsLabel->adjustSize(); // Derived Stats Points @@ -353,12 +355,12 @@ void StatusWindow::update() mXpBar->getX() + mXpBar->getWidth() + 5, mXpLabel->getY()); - mJobXpLabel->setPosition(mXpBar->getX() - mJobXpLabel->getWidth() - 5, + mJobXpLabel->setPosition(mXpBar->getX() - mJobXpLabel->getWidth() - 5, mMpLabel->getY()); mJobXpBar->setPosition( mJobXpLabel->getX() + mJobXpLabel->getWidth() + 5, mJobXpLabel->getY()); - mJobValueLabel->setPosition(mJobXpBar->getX() + mJobXpBar->getWidth() + 5, + mJobValueLabel->setPosition(mJobXpBar->getX() + mJobXpBar->getWidth() + 5, mJobXpLabel->getY()); } diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 9b88b6fb..405d871f 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -280,8 +280,8 @@ void TradeWindow::action(const gcn::ActionEvent &event) return; if (mMyInventory->contains(item)) { - chatWindow->chatLog("Failed adding item. You can not " - "overlap one kind of item on the window.", BY_SERVER); + chatWindow->chatLog(_("Failed adding item. You can not " + "overlap one kind of item on the window."), BY_SERVER); return; } diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 7f7d45fc..891fa769 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -40,6 +40,7 @@ #include "../log.h" #include "../main.h" +#include "../utils/gettext.h" #include "../utils/tostring.h" #include "../resources/resourcemanager.h" @@ -89,7 +90,7 @@ loadTextFile(const std::string &fileName) UpdaterWindow::UpdaterWindow(const std::string &updateHost, const std::string &updatesDir): - Window("Updating..."), + Window(_("Updating...")), mThread(NULL), mDownloadStatus(UPDATE_NEWS), mUpdateHost(updateHost), @@ -112,10 +113,10 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, mBrowserBox = new BrowserBox(); mScrollArea = new ScrollArea(mBrowserBox); - mLabel = new gcn::Label("Connecting..."); + mLabel = new gcn::Label(_("Connecting...")); mProgressBar = new ProgressBar(0.0, w - 10, 20, 37, 70, 200); - mCancelButton = new Button("Cancel", "cancel", this); - mPlayButton = new Button("Play", "play", this); + mCancelButton = new Button(_("Cancel"), "cancel", this); + mPlayButton = new Button(_("Play"), "play", this); mBrowserBox->setOpaque(false); mPlayButton->setEnabled(false); @@ -521,7 +522,7 @@ void UpdaterWindow::logic() break; case UPDATE_COMPLETE: enable(); - setLabel("Completed"); + setLabel(_("Completed")); break; case UPDATE_IDLE: break; diff --git a/src/main.cpp b/src/main.cpp index 3c106633..584ca5d5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -713,7 +713,7 @@ int main(int argc, char *argv[]) top->add(progressLabel, 15 + progressBar->getWidth(), progressBar->getY() + 4); progressBar->setVisible(false); - gcn::Button *setup = new Button("Setup", "Setup", &listener); + gcn::Button *setup = new Button(_("Setup"), "Setup", &listener); setup->setPosition(top->getWidth() - setup->getWidth() - 3, 3); top->add(setup); @@ -766,7 +766,7 @@ int main(int argc, char *argv[]) if (!network->getError().empty()) { errorMessage = network->getError(); } else { - errorMessage = "Got disconnected from server!"; + errorMessage = _("Got disconnected from server!"); } } @@ -942,7 +942,7 @@ int main(int argc, char *argv[]) case ERROR_STATE: logger->log("State: ERROR"); - currentDialog = new OkDialog("Error", errorMessage); + currentDialog = new OkDialog(_("Error"), errorMessage); currentDialog->addActionListener(&errorListener); currentDialog = NULL; // OkDialog deletes itself network->disconnect(); @@ -952,7 +952,8 @@ int main(int argc, char *argv[]) case CONNECTING_STATE: logger->log("State: CONNECTING"); progressBar->setVisible(true); - progressLabel->setCaption("Connecting to map server..."); + progressLabel->setCaption( + _("Connecting to map server...")); progressLabel->adjustSize(); mapLogin(network, &loginData); break; @@ -960,7 +961,7 @@ int main(int argc, char *argv[]) case CHAR_CONNECT_STATE: progressBar->setVisible(true); progressLabel->setCaption( - "Connecting to character server..."); + _("Connecting to character server...")); progressLabel->adjustSize(); charLogin(network, &loginData); break; @@ -968,7 +969,7 @@ int main(int argc, char *argv[]) case ACCOUNT_STATE: progressBar->setVisible(true); progressLabel->setCaption( - "Connecting to account server..."); + _("Connecting to account server...")); progressLabel->adjustSize(); accountLogin(network, &loginData); break; |