From f001a53b494e8b357eba6f7c0cad9afe3258dda8 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Thu, 5 Feb 2009 14:19:44 -0700 Subject: Exposed some more strings I found to be translatable. Signed-off-by: Ira Rice --- src/net/buysellhandler.cpp | 12 +++++++----- src/net/chathandler.cpp | 5 +++-- src/net/equipmenthandler.cpp | 6 ++++-- src/net/inventoryhandler.cpp | 10 ++++++---- src/net/loginhandler.cpp | 32 +++++++++++++++++++------------- src/net/maploginhandler.cpp | 8 +++++--- 6 files changed, 44 insertions(+), 29 deletions(-) (limited to 'src/net') diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp index 5292b6f9..67c79ec4 100644 --- a/src/net/buysellhandler.cpp +++ b/src/net/buysellhandler.cpp @@ -35,6 +35,8 @@ #include "../gui/chat.h" #include "../gui/sell.h" +#include "../utils/gettext.h" + extern BuyDialog *buyDialog; extern Window *buySellDialog; extern SellDialog *sellDialog; @@ -104,27 +106,27 @@ void BuySellHandler::handleMessage(MessageIn *msg) } } else { - chatWindow->chatLog("Nothing to sell", BY_SERVER); + chatWindow->chatLog(_("Nothing to sell"), BY_SERVER); current_npc = 0; } break; case SMSG_NPC_BUY_RESPONSE: if (msg->readInt8() == 0) { - chatWindow->chatLog("Thanks for buying", BY_SERVER); + chatWindow->chatLog(_("Thanks for buying"), BY_SERVER); } else { // Reset player money since buy dialog already assumed purchase // would go fine buyDialog->setMoney(player_node->mGp); - chatWindow->chatLog("Unable to buy", BY_SERVER); + chatWindow->chatLog(_("Unable to buy"), BY_SERVER); } break; case SMSG_NPC_SELL_RESPONSE: if (msg->readInt8() == 0) { - chatWindow->chatLog("Thanks for selling", BY_SERVER); + chatWindow->chatLog(_("Thanks for selling"), BY_SERVER); } else { - chatWindow->chatLog("Unable to sell", BY_SERVER); + chatWindow->chatLog(_("Unable to sell"), BY_SERVER); } break; } diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp index bf5a5a37..25877907 100644 --- a/src/net/chathandler.cpp +++ b/src/net/chathandler.cpp @@ -33,6 +33,7 @@ #include "../gui/chat.h" +#include "../utils/gettext.h" #include "../utils/tostring.h" #include "../utils/trim.h" @@ -72,10 +73,10 @@ void ChatHandler::handleMessage(MessageIn *msg) //chatWindow->chatLog("Whisper sent", BY_SERVER); break; case 0x01: - chatWindow->chatLog("Whisper could not be sent, user is offline", BY_SERVER); + chatWindow->chatLog(_("Whisper could not be sent, user is offline"), BY_SERVER); break; case 0x02: - chatWindow->chatLog("Whisper could not be sent, ignored by user", BY_SERVER); + chatWindow->chatLog(_("Whisper could not be sent, ignored by user"), BY_SERVER); break; } break; diff --git a/src/net/equipmenthandler.cpp b/src/net/equipmenthandler.cpp index 973de0f6..319d1205 100644 --- a/src/net/equipmenthandler.cpp +++ b/src/net/equipmenthandler.cpp @@ -32,6 +32,8 @@ #include "../gui/chat.h" +#include "../utils/gettext.h" + EquipmentHandler::EquipmentHandler() { static const Uint16 _messages[] = { @@ -97,7 +99,7 @@ void EquipmentHandler::handleMessage(MessageIn *msg) logger->log("Equipping: %i %i %i", index, equipPoint, type); if (!type) { - chatWindow->chatLog("Unable to equip.", BY_SERVER); + chatWindow->chatLog(_("Unable to equip."), BY_SERVER); break; } @@ -135,7 +137,7 @@ void EquipmentHandler::handleMessage(MessageIn *msg) type = msg->readInt8(); if (!type) { - chatWindow->chatLog("Unable to unequip.", BY_SERVER); + chatWindow->chatLog(_("Unable to unequip."), BY_SERVER); break; } diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp index 3ce0899a..46f03e28 100644 --- a/src/net/inventoryhandler.cpp +++ b/src/net/inventoryhandler.cpp @@ -35,6 +35,8 @@ #include "../resources/iteminfo.h" +#include "../utils/gettext.h" +#include "../utils/strprintf.h" #include "../utils/tostring.h" InventoryHandler::InventoryHandler() @@ -139,13 +141,13 @@ void InventoryHandler::handleMessage(MessageIn *msg) itemType = msg->readInt8(); if (msg->readInt8() > 0) { - chatWindow->chatLog("Unable to pick up item", BY_SERVER); + chatWindow->chatLog(_("Unable to pick up item"), BY_SERVER); } else { const ItemInfo &itemInfo = ItemDB::get(itemId); const std::string amountStr = (amount > 1) ? toString(amount) : "a"; - chatWindow->chatLog("You picked up " + amountStr + " " + - itemInfo.getName(), BY_SERVER); + chatWindow->chatLog(strprintf(_("You picked up %s %s"), + amountStr.c_str(), itemInfo.getName().c_str()), BY_SERVER); if (Item *item = inventory->getItem(index)) { item->setId(itemId); @@ -182,7 +184,7 @@ void InventoryHandler::handleMessage(MessageIn *msg) amount = msg->readInt16(); if (msg->readInt8() == 0) { - chatWindow->chatLog("Failed to use item", BY_SERVER); + chatWindow->chatLog(_("Failed to use item"), BY_SERVER); } else { if (Item *item = inventory->getItem(index)) item->setQuantity(amount); diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp index 6ad410ec..4f5f2acc 100644 --- a/src/net/loginhandler.cpp +++ b/src/net/loginhandler.cpp @@ -28,6 +28,8 @@ #include "../main.h" #include "../serverinfo.h" +#include "../utils/gettext.h" +#include "../utils/strprintf.h" #include "../utils/tostring.h" extern SERVER_INFO **server_info; @@ -56,16 +58,16 @@ void LoginHandler::handleMessage(MessageIn *msg) switch (code) { case 0: - errorMessage = "Authentication failed"; + errorMessage = _("Authentication failed"); break; case 1: - errorMessage = "No servers available"; + errorMessage = _("No servers available"); break; case 2: - errorMessage = "This account is already logged in"; + errorMessage = _("This account is already logged in"); break; default: - errorMessage = "Unknown connection error"; + errorMessage = _("Unknown connection error"); break; } state = ERROR_STATE; @@ -120,30 +122,34 @@ void LoginHandler::handleMessage(MessageIn *msg) switch (code) { case 0: - errorMessage = "Unregistered ID"; + errorMessage = _("Unregistered ID"); break; case 1: - errorMessage = "Wrong password"; + errorMessage = _("Wrong password"); break; case 2: - errorMessage = "Account expired"; + errorMessage = _("Account expired"); break; case 3: - errorMessage = "Rejected from server"; + errorMessage = _("Rejected from server"); break; case 4: - errorMessage = "You have been permanently banned from the game. Please contact the GM Team"; + errorMessage = _("You have been permanently banned from the" + " game. Please contact the GM Team"); break; case 6: - errorMessage = "You have been temporarily banned from the game until " - + msg->readString(20) + ".\n Please contact the GM team via the forums"; + errorMessage = strprintf(_("You have been temporarily " + "banned from the game until %s.\n" + " Please contact the GM team via " + "the forums"), + msg->readString(20).c_str()); break; case 9: - errorMessage = "This user name is already taken"; + errorMessage = _("This user name is already taken"); break; default: - errorMessage = "Unknown error"; + errorMessage = _("Unknown error"); break; } state = ERROR_STATE; diff --git a/src/net/maploginhandler.cpp b/src/net/maploginhandler.cpp index b851117e..b5192bd7 100644 --- a/src/net/maploginhandler.cpp +++ b/src/net/maploginhandler.cpp @@ -27,6 +27,8 @@ #include "../log.h" #include "../main.h" +#include "../utils/gettext.h" + MapLoginHandler::MapLoginHandler() { static const Uint16 _messages[] = { @@ -50,13 +52,13 @@ void MapLoginHandler::handleMessage(MessageIn *msg) switch (code) { case 0: - errorMessage = "Authentication failed"; + errorMessage = _("Authentication failed"); break; case 2: - errorMessage = "This account is already logged in"; + errorMessage = _("This account is already logged in"); break; default: - errorMessage = "Unknown connection error"; + errorMessage = _("Unknown connection error"); break; } state = ERROR_STATE; -- cgit v1.2.3-70-g09d2