diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-01-08 22:03:33 +0100 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-08 16:27:30 -0700 |
commit | 193ccbdba8031a351ea622f8842b6d9a0b6cfd43 (patch) | |
tree | 5e62faa24be231e60a3aa2643fa233f356ac23c7 /src | |
parent | 3f8387402ee7b528026450232cb457c8ae1cf4e2 (diff) | |
download | mana-193ccbdba8031a351ea622f8842b6d9a0b6cfd43.tar.gz mana-193ccbdba8031a351ea622f8842b6d9a0b6cfd43.tar.bz2 mana-193ccbdba8031a351ea622f8842b6d9a0b6cfd43.tar.xz mana-193ccbdba8031a351ea622f8842b6d9a0b6cfd43.zip |
Made remaining dialogs translatable
Most strings are now translatable. Please do report any missing ones.
Strings excluded from translation are anything that gets written to the
log file or is otherwise not shown in the GUI.
Signed-off-by: Bjørn Lindeijer <bjorn@lindeijer.nl>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/buysell.cpp | 10 | ||||
-rw-r--r-- | src/gui/chat.cpp | 192 | ||||
-rw-r--r-- | src/gui/colour.cpp | 20 | ||||
-rw-r--r-- | src/gui/help.cpp | 6 | ||||
-rw-r--r-- | src/gui/setup_colours.cpp | 4 | ||||
-rw-r--r-- | src/gui/setup_keyboard.cpp | 12 | ||||
-rw-r--r-- | src/gui/setup_players.cpp | 62 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 4 | ||||
-rw-r--r-- | src/gui/skill.cpp | 34 | ||||
-rw-r--r-- | src/gui/smileycontainer.cpp | 5 | ||||
-rw-r--r-- | src/gui/smileyshortcutcontainer.cpp | 3 | ||||
-rw-r--r-- | src/gui/smileywindow.cpp | 11 | ||||
-rw-r--r-- | src/gui/speechbubble.cpp | 4 | ||||
-rw-r--r-- | src/gui/status.cpp | 90 | ||||
-rw-r--r-- | src/gui/trade.cpp | 4 | ||||
-rw-r--r-- | src/gui/updatewindow.cpp | 31 | ||||
-rw-r--r-- | src/main.cpp | 90 |
17 files changed, 312 insertions, 270 deletions
diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index 57c95841..724ae8a1 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -24,18 +24,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 71954601..35976963 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -42,12 +42,14 @@ #include "../net/messageout.h" #include "../net/protocol.h" +#include "../utils/gettext.h" +#include "../utils/strprintf.h" #include "../utils/trim.h" ChatWindow::ChatWindow(Network * network): Window(""), mNetwork(network), mTmpVisible(false) { - setWindowName("Chat"); + setWindowName(_("Chat")); setResizable(true); setDefaultSize(0, windowContainer->getHeight() - 123, 600, 123); @@ -127,7 +129,7 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord) tmp.text = line.substr(pos + 3); } else { // Fix the owner of welcome message. - if (line.substr(0, 7) == "Welcome") + if (line.substr(0, 7) == _("Welcome")) { own = BY_SERVER; } @@ -138,12 +140,12 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord) case BY_GM: if (tmp.nick.empty()) { - tmp.nick = std::string("Global announcement: "); + tmp.nick = std::string(_("Global announcement: ")); lineColor = "##G"; } else { - tmp.nick = std::string("Global announcement from " + tmp.nick + tmp.nick = std::string(_("Global announcement from ") + tmp.nick + std::string(": ")); lineColor = "##1"; // Equiv. to BrowserBox::RED } @@ -157,7 +159,8 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord) lineColor = "##C"; break; case BY_SERVER: - tmp.nick = "Server: "; + tmp.nick = _("Server:"); + tmp.nick += " "; tmp.text = line; lineColor = "##S"; break; @@ -281,7 +284,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) std::size_t length = msg.length() + 1; if (length == 0) { - chatLog("Trying to send a blank party message.", BY_SERVER); + chatLog(_("Trying to send a blank party message."), BY_SERVER); return; } MessageOut outMsg(mNetwork); @@ -383,7 +386,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) outMsg.writeString(recvnick, 24); outMsg.writeString(msg, msg.length()); - chatLog("Whispering to " + recvnick + " : " + msg, BY_PLAYER); + chatLog(_("Whispering to ") + recvnick + " : " + msg, BY_PLAYER); return; } if (command == "record") { @@ -392,29 +395,29 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) } if (command == "toggle") { if (msg == "") { - chatLog(mReturnToggles ? "Return toggles chat." - : "Message closes chat.", BY_SERVER); + chatLog(mReturnToggles ? _("Return toggles chat.") + : _("Message closes chat."), BY_SERVER); return; } msg = msg.substr(0, 1); if (msg == "1" || msg == "y" || msg == "t" || msg == "Y" || msg == "T") { - chatLog("Return now toggles chat.", BY_SERVER); + chatLog(_("Return now toggles chat."), BY_SERVER); mReturnToggles = true; return; } if (msg == "0" || msg == "n" || msg == "f" || msg == "N" || msg == "F") { - chatLog("Message now closes chat.", BY_SERVER); + chatLog(_("Message now closes chat."), BY_SERVER); mReturnToggles = false; return; } - chatLog("Options to /toggle are \"yes\", \"no\", \"true\", \"false\", " - "\"1\", \"0\".", BY_SERVER); + chatLog(_("Options to /toggle are \"yes\", \"no\", \"true\", \"false\", " + "\"1\", \"0\"."), BY_SERVER); return; } if (command == "party") { if (msg == "") { - chatLog("Unknown party command... Type \"/help\" party for more " - "information.", BY_SERVER); + chatLog(_("Unknown party command... Type \"/help\" party for more " + "information."), BY_SERVER); return; } const std::string::size_type space = msg.find(" "); @@ -451,10 +454,10 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) outMsg.writeInt8(0); outMsg.writeString("", 24); } else { - chatLog("No such spell!", BY_SERVER); + chatLog(_("No such spell!"), BY_SERVER); } } else { - chatLog("The current server doesn't support spells", BY_SERVER); + chatLog(_("The current server doesn't support spells"), BY_SERVER); } return; } @@ -484,14 +487,14 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) << "] "; - mRecorder->record(timeStr.str() + "Present: " + response + "."); - chatLog("Attendance written to record log.", BY_SERVER, true); + mRecorder->record(timeStr.str() + _("Present: ") + response + "."); + chatLog(_("Attendance written to record log."), BY_SERVER, true); } else { - chatLog("Present: " + response, BY_SERVER); + chatLog(_("Present: ") + response, BY_SERVER); } return; } - chatLog("Unknown command", BY_SERVER); + chatLog(_("Unknown command"), BY_SERVER); } std::string ChatWindow::const_msg(CHATSKILL act) @@ -500,70 +503,72 @@ std::string ChatWindow::const_msg(CHATSKILL act) if (act.success == SKILL_FAILED && act.skill == SKILL_BASIC) { switch (act.bskill) { case BSKILL_TRADE: - msg = "Trade failed!"; + msg = _("Trade failed!"); break; case BSKILL_EMOTE: - msg = "Emote failed!"; + msg = _("Emote failed!"); break; case BSKILL_SIT: - msg = "Sit failed!"; + msg = _("Sit failed!"); break; case BSKILL_CREATECHAT: - msg = "Chat creating failed!"; + msg = _("Chat creating failed!"); break; case BSKILL_JOINPARTY: - msg = "Could not join party!"; + msg = _("Could not join party!"); break; case BSKILL_SHOUT: - msg = "Cannot shout!"; + msg = _("Cannot shout!"); break; } + msg += " "; + switch (act.reason) { case RFAIL_SKILLDEP: - msg += " You have not yet reached a high enough level!"; + msg += _("You have not yet reached a high enough lvl!"); break; case RFAIL_INSUFHP: - msg += " Insufficient HP!"; + msg += _("Insufficient HP!"); break; case RFAIL_INSUFSP: - msg += " Insufficient SP!"; + msg += _("Insufficient SP!"); break; case RFAIL_NOMEMO: - msg += " You have no memos!"; + msg += _("You have no memos!"); break; case RFAIL_SKILLDELAY: - msg += " You cannot do that right now!"; + msg += _("You cannot do that right now!"); break; case RFAIL_ZENY: - msg += " Seems you need more Zeny... ;-)"; + msg += _("Seems you need more Zeny... ;-)"); break; case RFAIL_WEAPON: - msg += " You cannot use this skill with that kind of weapon!"; + msg += _("You cannot use this skill with that kind of weapon!"); break; case RFAIL_REDGEM: - msg += " You need another red gem!"; + msg += _("You need another red gem!"); break; case RFAIL_BLUEGEM: - msg += " You need another blue gem!"; + msg += _("You need another blue gem!"); break; case RFAIL_OVERWEIGHT: - msg += " You're carrying to much to do this!"; + msg += _("You're carrying to much to do this!"); break; default: - msg += " Huh? What's that?"; + msg += _("Huh? What's that?"); break; } } else { switch (act.skill) { - case SKILL_WARP: - msg = "Warp failed..."; + case SKILL_WARP : + msg = _("Warp failed..."); break; - case SKILL_STEAL: - msg = "Could not steal anything..."; + case SKILL_STEAL : + msg = _("Could not steal anything..."); break; - case SKILL_ENVENOM: - msg = "Poison had no effect..."; + case SKILL_ENVENOM : + msg = _("Poison had no effect..."); break; } } @@ -631,18 +636,18 @@ void ChatWindow::party(const std::string & command, const std::string & rest) if (rest == "") { char temp[2] = "."; *temp = mPartyPrefix; - chatLog("The current party prefix is " + std::string(temp), + chatLog(_("The current party prefix is ") + std::string(temp), BY_SERVER); return; } if (rest.length() != 1) { - chatLog("Party prefix must be one character long.", BY_SERVER); + chatLog(_("Party prefix must be one character long."), BY_SERVER); } else { if (rest == "/") { - chatLog("Cannot use a '/' as the prefix.", BY_SERVER); + chatLog(_("Cannot use a '/' as the prefix."), BY_SERVER); } else { mPartyPrefix = rest.at(0); - chatLog("Changing prefix to " + rest, BY_SERVER); + chatLog(_("Changing prefix to ") + rest, BY_SERVER); } } return; @@ -652,45 +657,47 @@ void ChatWindow::party(const std::string & command, const std::string & rest) 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(_("/announce: Global announcement (GM only)"), BY_SERVER); + chatLog(_("/clear: Clears this window"), BY_SERVER); + chatLog(_("/help: Display this help"), BY_SERVER); mParty->help(); - chatLog("/present: Get list of players present", BY_SERVER); + chatLog(_("/msg <nick> <message>: Alternate form for /whisper"), BY_SERVER); + chatLog(_("/present: Get list of players present"), BY_SERVER); mRecorder->help(); - chatLog("/toggle: Determine whether <return> toggles the chat log.", + chatLog(_("/toggle: Determine whether <return> toggles the chat log."), BY_SERVER); - chatLog("/where: Display map name", BY_SERVER); - chatLog("/whisper <nick> <message>: Sends a private <message>" - " to <nick>", BY_SERVER); - chatLog("/who: Display number of online users", BY_SERVER); - chatLog("For more information, type /help <command>", BY_SERVER); + chatLog(_("/where: Display map name"), BY_SERVER); + chatLog(_("/w <nick> <message>: Short form for /whisper"), BY_SERVER); + chatLog(_("/whisper <nick> <message>: Sends a private <message>" + " to <nick>"), 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 == "party") @@ -700,10 +707,8 @@ void ChatWindow::help(const std::string & msg1, const std::string & msg2) } if (msg1 == "present") { - chatLog("Command: /present", BY_SERVER); - chatLog("This command gets a list of players within hearing " - "and sends it to either the record log if recording, or the " - "chat log otherwise.", BY_SERVER); + chatLog(_("Command: /present"), BY_SERVER); + chatLog(_("This command gets a list of players within hearing and sends it to either the record log if recording, or the chat log otherwise."), BY_SERVER); return; } if (msg1 == "record") @@ -713,38 +718,39 @@ void ChatWindow::help(const std::string & msg1, const std::string & msg2) } if (msg1 == "toggle") { - chatLog("Command: /toggle <state>", BY_SERVER); - chatLog("This command sets whether the return key should toggle the " - "chat log, or whether the chat log turns off automatically.", + chatLog(_("Command: /toggle <state>"), BY_SERVER); + chatLog(_("This command sets whether the return key should toggle the chat log, or whether the chat log turns off automatically."), BY_SERVER); - chatLog("<state> can be one of \"1\", \"yes\", \"true\" to turn " - "the toggle on, or \"0\", \"no\", \"false\" to turn the " - "toggle off.", BY_SERVER); - chatLog("Command: /toggle", BY_SERVER); - chatLog("This command displays the return toggle status.", BY_SERVER); + chatLog(_("<state> can be one of \"1\", \"yes\", \"true\" to turn the toggle on, or \"0\", \"no\", \"false\" to turn the toggle off."), BY_SERVER); + chatLog(_("Command: /toggle"), BY_SERVER); + chatLog(_("This command displays the return toggle status."), 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 == "msg" || msg1 == "w") { - chatLog("Command: /whisper <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); + if (msg1 == "whisper" || msg1 == "msg" || msg1 == "w") + { + chatLog(_("Command: /msg <nick> <msg>"), 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/colour.cpp b/src/gui/colour.cpp index 4c3782a4..816420ed 100644 --- a/src/gui/colour.cpp +++ b/src/gui/colour.cpp @@ -25,17 +25,19 @@ #include "../configuration.h" +#include "../utils/gettext.h" + Colour::Colour() { - addColour('C', 0x000000, "Chat"); - addColour('G', 0xff0000, "GM"); - addColour('Y', 0x1fa052, "Player"); - addColour('W', 0x0000ff, "Whisper"); - addColour('I', 0xf1dc27, "Is"); - addColour('P', 0xff00d8, "Party"); - addColour('S', 0x8415e2, "Server"); - addColour('L', 0x919191, "Logger"); - addColour('<', 0xe50d0d, "Hyperlink"); + addColour('C', 0x000000, _("Chat")); + addColour('G', 0xff0000, _("GM")); + addColour('Y', 0x1fa052, _("Player")); + addColour('W', 0x0000ff, _("Whisper")); + addColour('I', 0xf1dc27, _("Is")); + addColour('P', 0xff00d8, _("Party")); + addColour('S', 0x8415e2, _("Server")); + addColour('L', 0x919191, _("Logger")); + addColour('<', 0xe50d0d, _("Hyperlink")); commit(); } diff --git a/src/gui/help.cpp b/src/gui/help.cpp index 19413a08..3594b9a6 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -26,8 +26,10 @@ #include "../resources/resourcemanager.h" +#include "../utils/gettext.h" + HelpWindow::HelpWindow(): - Window("Help") + Window(_("Help")) { setContentSize(455, 350); setWindowName("Help"); @@ -35,7 +37,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_colours.cpp b/src/gui/setup_colours.cpp index 0becd48f..dca47630 100644 --- a/src/gui/setup_colours.cpp +++ b/src/gui/setup_colours.cpp @@ -32,8 +32,10 @@ #include "../configuration.h" +#include "../utils/gettext.h" + Setup_Colours::Setup_Colours() : - mColourLabel("Colour:"), + mColourLabel(_("Colour:")), mSelected(-1) { mColourBox = new gcn::ListBox(textColour); diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp index 007fcb52..75fa542f 100644 --- a/src/gui/setup_keyboard.cpp +++ b/src/gui/setup_keyboard.cpp @@ -33,6 +33,7 @@ #include "../configuration.h" #include "../keyboardconfig.h" +#include "../utils/gettext.h" #include "../utils/tostring.h" /** @@ -83,13 +84,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); @@ -110,8 +111,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(); @@ -169,7 +171,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 d07a9685..0f52be41 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -34,6 +34,8 @@ #include "../player_relations.h" #include "../sound.h" +#include "../utils/gettext.h" + #define COLUMNS_NR 2 // name plus listbox #define NAME_COLUMN 0 #define RELATION_CHOICE_COLUMN 1 @@ -46,10 +48,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 @@ -66,7 +74,7 @@ public: { if (i >= getNumberOfElements() || i < 0) return ""; - return RELATION_NAMES[i]; + return gettext(RELATION_NAMES[i]); } }; @@ -135,7 +143,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())); } @@ -185,7 +194,7 @@ public: virtual std::string getElementAt(int i) { if (i >= getNumberOfElements()) { - return "???"; + return _("???"); } return (*player_relations.getPlayerIgnoreStrategies())[i]->mDescription; } @@ -201,21 +210,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)); @@ -226,7 +241,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) 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] == @@ -306,9 +321,10 @@ 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(); @@ -340,6 +356,8 @@ 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/setup_video.cpp b/src/gui/setup_video.cpp index f53a9716..724ce8b4 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -86,9 +86,9 @@ ModeListModel::ModeListModel() /* Check which modes are available */ if (modes == (SDL_Rect **)0) { - logger->log("No modes available"); + logger->log(_("No modes available")); } else if (modes == (SDL_Rect **)-1) { - logger->log("All resolutions available"); + logger->log(_("All resolutions available")); } else { //logger->log("Available Modes"); for (int i = 0; modes[i]; ++i) { diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 321a6c52..5e5782d9 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -32,9 +32,11 @@ #include "../log.h" #include "../utils/dtor.h" +#include "../utils/gettext.h" +#include "../utils/strprintf.h" #include "../utils/xml.h" -#define SKILLS_FILE "skills.xml" +static const char *SKILLS_FILE = "skills.xml"; struct SkillInfo { std::string name; @@ -77,7 +79,7 @@ public: virtual void update(void) { - static const SkillInfo fakeSkillInfo = { "???", false }; + static const SkillInfo fakeSkillInfo = { _("???"), false }; mEntriesNr = mDialog->getSkills().size(); resize(); @@ -94,13 +96,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); @@ -116,22 +118,22 @@ private: SkillDialog::SkillDialog(): - Window("Skills") + Window(_("Skills")) { initSkillinfo(); mTableModel = new SkillGuiTableModel(this); mTable.setModel(mTableModel); mTable.setLinewiseSelection(true); - setWindowName("Skills"); + setWindowName(_("Skills")); setCloseButton(true); setDefaultSize(windowContainer->getWidth() - 260, 25, 255, 260); // mSkillListBox = new ListBox(this); - skillScrollArea = new ScrollArea(&mTable); - mPointsLabel = new gcn::Label("Skill Points:"); - mIncButton = new Button("Up", "inc", this); - mUseButton = new Button("Use", "use", this); + ScrollArea *skillScrollArea = new ScrollArea(&mTable); + 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"); @@ -185,11 +187,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(); @@ -260,8 +259,7 @@ initSkillinfo(void) 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/smileycontainer.cpp b/src/gui/smileycontainer.cpp index 5eb99723..d5e2e815 100644 --- a/src/gui/smileycontainer.cpp +++ b/src/gui/smileycontainer.cpp @@ -31,6 +31,7 @@ #include "../resources/iteminfo.h" #include "../resources/resourcemanager.h" +#include "../utils/gettext.h" #include "../utils/tostring.h" const int SmileyContainer::gridWidth = 34; // item icon width + 4 @@ -44,10 +45,10 @@ SmileyContainer::SmileyContainer(): ResourceManager *resman = ResourceManager::getInstance(); mSmileyImg = resman->getImageSet("graphics/gui/emotions.png",30,32); - if (!mSmileyImg) logger->error("Unable to load emotions"); + if (!mSmileyImg) logger->error(_("Unable to load emotions")); mSelImg = resman->getImage("graphics/gui/selection.png"); - if (!mSelImg) logger->error("Unable to load selection.png"); + if (!mSelImg) logger->error(_("Unable to load selection.png")); mMaxSmiley = mSmileyImg->size(); diff --git a/src/gui/smileyshortcutcontainer.cpp b/src/gui/smileyshortcutcontainer.cpp index 5a9c3036..f857ed5d 100644 --- a/src/gui/smileyshortcutcontainer.cpp +++ b/src/gui/smileyshortcutcontainer.cpp @@ -33,6 +33,7 @@ #include "../resources/image.h" #include "../resources/resourcemanager.h" +#include "../utils/gettext.h" #include "../utils/tostring.h" SmileyShortcutContainer::SmileyShortcutContainer(): @@ -48,7 +49,7 @@ SmileyShortcutContainer::SmileyShortcutContainer(): mBackgroundImg = resman->getImage("graphics/gui/item_shortcut_bgr.png"); mSmileyImg = resman->getImageSet("graphics/gui/emotions.png",30,32); - if (!mSmileyImg) logger->error("Unable to load emotions"); + if (!mSmileyImg) logger->error(_("Unable to load emotions")); mMaxItems = 12; diff --git a/src/gui/smileywindow.cpp b/src/gui/smileywindow.cpp index faf634af..570eb45c 100644 --- a/src/gui/smileywindow.cpp +++ b/src/gui/smileywindow.cpp @@ -28,19 +28,22 @@ #include "smileywindow.h" #include "smileycontainer.h" #include "scrollarea.h" -#include "../localplayer.h" + +#include "../localplayer.h" + +#include "../utils/gettext.h" #include "../utils/tostring.h" SmileyWindow::SmileyWindow(): - Window("Emote") + Window(_("Emote")) { - setWindowName("Emote"); + setWindowName(_("Emote")); setResizable(true); setCloseButton(true); setMinWidth(80); setDefaultSize(115, 25, 322, 200); - mUseButton = new Button("Use", "use", this); + mUseButton = new Button(_("Use"), "use", this); mItems = new SmileyContainer(); mItems->addSelectionListener(this); diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index 6af16496..5539202e 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -27,10 +27,12 @@ #include "../resources/image.h" #include "../resources/resourcemanager.h" +#include "../utils/gettext.h" + // TODO: Fix windows so that they can each load their own skins without the // other windows overriding another window's skin. SpeechBubble::SpeechBubble(): - Window("Message", false, NULL, "graphics/gui/speechbubble.xml") + Window(_("Message"), false, NULL, "graphics/gui/speechbubble.xml") { mSpeechBox = new TextBox(); mSpeechBox->setEditable(false); diff --git a/src/gui/status.cpp b/src/gui/status.cpp index fbcc01d6..64f3db48 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -28,13 +28,15 @@ #include "../localplayer.h" +#include "../utils/gettext.h" +#include "../utils/strprintf.h" #include "../utils/tostring.h" StatusWindow::StatusWindow(LocalPlayer *player): Window(player->getName()), mPlayer(player) { - setWindowName("Status"); + setWindowName(_("Status")); setCloseButton(true); setDefaultSize((windowContainer->getWidth() - 365) / 2, (windowContainer->getHeight() - 255) / 2, 365, 275); @@ -44,25 +46,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; @@ -120,34 +122,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); @@ -225,13 +227,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) + @@ -274,20 +276,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])); @@ -297,8 +299,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 @@ -351,12 +353,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 4546cd9e..f6e1c5ea 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 e0a9da2e..72cbb34a 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -43,6 +43,7 @@ #include "../resources/resourcemanager.h" +#include "../utils/gettext.h" #include "../utils/tostring.h" /** @@ -75,7 +76,7 @@ loadTextFile(const std::string &fileName) std::ifstream fin(fileName.c_str()); if (!fin) { - logger->log("Couldn't load text file: %s", fileName.c_str()); + logger->log(_("Couldn't load text file: %s"), fileName.c_str()); return lines; } @@ -90,7 +91,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), @@ -109,10 +110,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, 310, 20, 168, 116, 31); - 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); @@ -193,7 +194,7 @@ void UpdaterWindow::loadNews() { if (!mMemoryBuffer) { - logger->log("Couldn't load news"); + logger->log(_("Couldn't load news")); return; } @@ -324,8 +325,8 @@ int UpdaterWindow::downloadThread(void *ptr) { case CURLE_COULDNT_CONNECT: default: - std::cerr << "curl error " << res << ": " - << uw->mCurlError << " host: " << url.c_str() + std::cerr << _("curl error ") << res << ": " + << uw->mCurlError << _(" host: ") << url.c_str() << std::endl; break; } @@ -360,7 +361,7 @@ int UpdaterWindow::downloadThread(void *ptr) // Remove the corrupted file ::remove(outFilename.c_str()); logger->log( - "Checksum for file %s failed: (%lx/%lx)", + _("Checksum for file %s failed: (%lx/%lx)"), uw->mCurrentFile.c_str(), adler, uw->mCurrentChecksum); attempts++; @@ -410,7 +411,7 @@ void UpdaterWindow::download() if (mThread == NULL) { - logger->log("Unable to create mThread"); + logger->log(_("Unable to create mThread")); mDownloadStatus = UPDATE_ERROR; } } @@ -448,9 +449,9 @@ void UpdaterWindow::logic() mThread = NULL; } mBrowserBox->addRow(""); - mBrowserBox->addRow("##1 The update process is incomplete."); - mBrowserBox->addRow("##1 It is strongly recommended that"); - mBrowserBox->addRow("##1 you try again later"); + mBrowserBox->addRow(_("##1 The update process is incomplete.")); + mBrowserBox->addRow(_("##1 It is strongly recommended that")); + mBrowserBox->addRow(_("##1 you try again later")); mBrowserBox->addRow(mCurlError); mScrollArea->setVerticalScrollAmount( mScrollArea->getVerticalMaxScroll()); @@ -504,7 +505,7 @@ void UpdaterWindow::logic() } else { - logger->log("%s already here", mCurrentFile.c_str()); + logger->log(_("%s already here"), mCurrentFile.c_str()); } mLineIndex++; } @@ -517,7 +518,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 4a3acce8..c15011ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -202,12 +202,12 @@ void setUpdatesDir() << "/" << loginData.port; updatesDir = updates.str(); } else { - logger->log("Error: Invalid update host: %s", updateHost.c_str()); - errorMessage = "Invalid update host: " + updateHost; + logger->log(_("Error: Invalid update host: %s"), updateHost.c_str()); + errorMessage = _("Invalid update host: ") + updateHost; state = ERROR_STATE; } } else { - logger->log("Warning: no protocol was specified for the update host"); + logger->log(_("Warning: no protocol was specified for the update host")); updates << "updates/" << updateHost << "/" << loginData.port; updatesDir = updates.str(); } @@ -217,9 +217,9 @@ void setUpdatesDir() // Verify that the updates directory exists. Create if necessary. if (!resman->isDirectory("/" + updatesDir)) { if (!resman->mkdir("/" + updatesDir)) { - logger->log("Error: %s/%s can't be made, but doesn't exist!", + logger->log(_("Error: %s/%s can't be made, but doesn't exist!"), homeDir.c_str(), updatesDir.c_str()); - errorMessage = "Error creating updates directory!"; + errorMessage = _("Error creating updates directory!"); state = ERROR_STATE; } } @@ -247,7 +247,7 @@ void init_engine(const Options &options) #endif { std::cout << homeDir - << " can't be created, but it doesn't exist! Exiting." + << _(" can't be created, but it doesn't exist! Exiting.") << std::endl; exit(1); } @@ -256,15 +256,15 @@ void init_engine(const Options &options) logger->setLogFile(homeDir + std::string("/aethyra.log")); #ifdef PACKAGE_VERSION - logger->log("Starting Aethyra Version %s", PACKAGE_VERSION); + logger->log(_("Starting Aethyra Version %s"), PACKAGE_VERSION); #else - logger->log("Starting Aethyra - Version not defined"); + logger->log(_("Starting Aethyra - Version not defined")); #endif // Initialize SDL - logger->log("Initializing SDL..."); + logger->log(_("Initializing SDL...")); if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) { - std::cerr << "Could not initialize SDL: " << + std::cerr << _("Could not initialize SDL: ") << SDL_GetError() << std::endl; exit(1); } @@ -277,7 +277,7 @@ void init_engine(const Options &options) if (!resman->setWriteDir(homeDir)) { std::cout << homeDir - << " couldn't be set as home directory! Exiting." + << _(" couldn't be set as home directory! Exiting.") << std::endl; exit(1); } @@ -297,7 +297,7 @@ void init_engine(const Options &options) if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) { - fprintf(stderr, "Can't find Resources directory\n"); + fprintf(stderr, _("Can't find Resources directory\n")); } CFRelease(resourcesURL); strncat(path, "/data", PATH_MAX - 1); @@ -307,7 +307,7 @@ void init_engine(const Options &options) #endif // Fill configuration with defaults - logger->log("Initializing configuration..."); + logger->log(_("Initializing configuration...")); config.setValue("host", "www.aethyra.org"); config.setValue("port", 21001); config.setValue("hwaccel", 0); @@ -390,8 +390,8 @@ void init_engine(const Options &options) // Try to set the desired video mode if (!graphics->setVideoMode(width, height, bpp, fullscreen, hwaccel)) { - std::cerr << "Couldn't set " - << width << "x" << height << "x" << bpp << " video mode: " + std::cerr << _("Couldn't set ") + << width << "x" << height << "x" << bpp << _(" video mode: ") << SDL_GetError() << std::endl; exit(1); } @@ -418,7 +418,7 @@ void init_engine(const Options &options) catch (const char *err) { state = ERROR_STATE; errorMessage = err; - logger->log("Warning: %s", err); + logger->log(_("Warning: %s"), err); } // Initialize keyboard @@ -458,29 +458,28 @@ void exit_engine() void printHelp() { std::cout - << "aethyra" << std::endl << std::endl - << "Options: " << std::endl - << " -C --configfile : Configuration file to use" << std::endl - << " -d --data : Directory to load game data from" << std::endl - << " -D --default : Bypass the login process with default " - "settings" << std::endl - << " -h --help : Display this help" << std::endl - << " -H --updatehost : Use this update host" << std::endl - << " -p --playername : Login with this player" << std::endl - << " -P --password : Login with this password" << std::endl - << " -u --skipupdate : Skip the update downloads" << std::endl - << " -U --username : Login with this username" << std::endl - << " -v --version : Display the version" << std::endl; + << _("aethyra") << std::endl << std::endl + << _("Options: ") << std::endl + << _(" -C --configfile : Configuration file to use") << std::endl + << _(" -d --data : Directory to load game data from") << std::endl + << _(" -D --default : Bypass the login process with default settings") << std::endl + << _(" -h --help : Display this help") << std::endl + << _(" -H --updatehost : Use this update host") << std::endl + << _(" -p --playername : Login with this player") << std::endl + << _(" -P --password : Login with this password") << std::endl + << _(" -u --skipupdate : Skip the update downloads") << std::endl + << _(" -U --username : Login with this username") << std::endl + << _(" -v --version : Display the version") << std::endl; } void printVersion() { #ifdef PACKAGE_VERSION - std::cout << "Aethyra version " << PACKAGE_VERSION << + std::cout << _("Aethyra version ") << PACKAGE_VERSION << std::endl; #else - std::cout << "Aethyra version " << - "(local build?, PACKAGE_VERSION is not defined)" << std::endl; + std::cout << _("Aethyra version ") << + _("(local build?, PACKAGE_VERSION is not defined)") << std::endl; #endif } @@ -576,8 +575,8 @@ struct ErrorListener : public gcn::ActionListener // TODO Find some nice place for these functions void accountLogin(Network *network, LoginData *loginData) { - logger->log("Trying to connect to account server..."); - logger->log("Username is %s", loginData->username.c_str()); + logger->log(_("Trying to connect to account server...")); + logger->log(_("Username is %s"), loginData->username.c_str()); network->connect(loginData->hostname, loginData->port); network->registerHandler(&loginHandler); loginHandler.setLoginData(loginData); @@ -631,7 +630,7 @@ void positionDialog(Window *dialog, int screenWidth, int screenHeight) void charLogin(Network *network, LoginData *loginData) { - logger->log("Trying to connect to char server..."); + logger->log(_("Trying to connect to char server...")); network->connect(loginData->hostname, loginData->port); network->registerHandler(&charServerHandler); charServerHandler.setCharInfo(&charInfo); @@ -653,14 +652,14 @@ void charLogin(Network *network, LoginData *loginData) void mapLogin(Network *network, LoginData *loginData) { - logger->log("Memorizing selected character %s", + logger->log(_("Memorizing selected character %s"), player_node->getName().c_str()); config.setValue("lastCharacter", player_node->getName()); MessageOut outMsg(network); - logger->log("Trying to connect to map server..."); - logger->log("Map: %s", map_path.c_str()); + logger->log(_("Trying to connect to map server...")); + logger->log(_("Map: %s"), map_path.c_str()); network->connect(loginData->hostname, loginData->port); network->registerHandler(&mapLoginHandler); @@ -745,7 +744,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); @@ -787,7 +786,7 @@ int main(int argc, char *argv[]) login_wallpaper = ResourceManager::getInstance()-> getImage(wallpaperName); if (!login_wallpaper) - logger->log("Couldn't load %s as wallpaper", wallpaperName.c_str()); + logger->log(_("Couldn't load %s as wallpaper"), wallpaperName.c_str()); // Needs to be created in main, as the updater uses it textColour = new Colour(); @@ -823,7 +822,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!"); } } @@ -1013,7 +1012,7 @@ int main(int argc, char *argv[]) case ERROR_STATE: logger->log("State: ERROR"); - currentDialog = new OkDialog("Error", errorMessage); + currentDialog = new OkDialog(_("Error"), errorMessage); positionDialog(currentDialog, screenWidth, screenHeight); currentDialog->addActionListener(&errorListener); currentDialog = NULL; // OkDialog deletes itself @@ -1024,7 +1023,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; @@ -1032,7 +1032,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; @@ -1040,7 +1040,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; |