From c98665d62a089c978189662c3f526464365f08fa Mon Sep 17 00:00:00 2001 From: Kess Vargavind Date: Sun, 26 Jul 2009 16:52:53 +0200 Subject: Gettext fixes And a Swedish translation of the desktop file. --- src/engine.cpp | 2 +- src/gui/buy.cpp | 8 ++++---- src/gui/changeemaildialog.cpp | 2 +- src/gui/charcreatedialog.cpp | 8 ++++---- src/gui/chat.cpp | 4 ++-- src/gui/connectiondialog.cpp | 2 +- src/gui/debugwindow.cpp | 32 +++++++++++++++++--------------- src/gui/debugwindow.h | 2 +- src/gui/itemamount.cpp | 10 +++++----- src/gui/minimap.cpp | 2 +- src/gui/npcdialog.cpp | 8 ++++---- src/gui/outfitwindow.cpp | 8 ++++---- src/gui/sell.cpp | 8 ++++---- src/gui/serverdialog.cpp | 2 +- src/gui/skilldialog.cpp | 2 +- src/gui/statuswindow.cpp | 10 +++++----- src/gui/unregisterdialog.cpp | 2 +- src/gui/widgets/chattab.cpp | 2 +- src/net/ea/playerhandler.cpp | 4 ++-- src/net/tmwserv/beinghandler.cpp | 4 ++-- 20 files changed, 62 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/engine.cpp b/src/engine.cpp index d33607ec..f56f8a49 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -85,7 +85,7 @@ bool Engine::changeMap(const std::string &mapPath) if (!newMap) { logger->log("Error while loading %s", map_path.c_str()); - new OkDialog(_("Could not load map"), + new OkDialog(_("Could Not Load Map"), strprintf(_("Error while loading %s"), map_path.c_str())); } diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 22572b63..9040364b 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -67,8 +67,8 @@ BuyDialog::BuyDialog(): mMoneyLabel = new Label(strprintf(_("Price: %s / Total: %s"), "", "")); - mIncreaseButton = new Button("+", "+", this); - mDecreaseButton = new Button("-", "-", this); + mIncreaseButton = new Button(_("+"), "inc", this); + mDecreaseButton = new Button(_("-"), "dec", this); mBuyButton = new Button(_("Buy"), "buy", this); mQuitButton = new Button(_("Quit"), "quit", this); mAddMaxButton = new Button(_("Max"), "max", this); @@ -162,13 +162,13 @@ void BuyDialog::action(const gcn::ActionEvent &event) mAmountItems = (int) mSlider->getValue(); updateButtonsAndLabels(); } - else if (event.getId() == "+" && mAmountItems < mMaxItems) + else if (event.getId() == "inc" && mAmountItems < mMaxItems) { mAmountItems++; mSlider->setValue(mAmountItems); updateButtonsAndLabels(); } - else if (event.getId() == "-" && mAmountItems > 1) + else if (event.getId() == "dec" && mAmountItems > 1) { mAmountItems--; mSlider->setValue(mAmountItems); diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index 362c7e17..eb05e25e 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -46,7 +46,7 @@ ChangeEmailDialog::ChangeEmailDialog(Window *parent, LoginData *loginData): { gcn::Label *accountLabel = new Label(strprintf(_("Account: %s"), mLoginData->username.c_str())); - gcn::Label *newEmailLabel = new Label(_("Type New Email Address twice:")); + gcn::Label *newEmailLabel = new Label(_("Type new email address twice:")); mFirstEmailField = new TextField; mSecondEmailField = new TextField; mChangeEmailButton = new Button(_("Change Email Address"), "change_email", this); diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 79ec5c1a..63b9cf46 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -64,11 +64,11 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot): mNameField = new TextField(""); mNameLabel = new Label(_("Name:")); - mNextHairColorButton = new Button(">", "nextcolor", this); - mPrevHairColorButton = new Button("<", "prevcolor", this); + mNextHairColorButton = new Button(_(">"), "nextcolor", this); + mPrevHairColorButton = new Button(_("<"), "prevcolor", this); mHairColorLabel = new Label(_("Hair Color:")); - mNextHairStyleButton = new Button(">", "nextstyle", this); - mPrevHairStyleButton = new Button("<", "prevstyle", this); + mNextHairStyleButton = new Button(_(">"), "nextstyle", this); + mPrevHairStyleButton = new Button(_("<"), "prevstyle", this); mHairStyleLabel = new Label(_("Hair Style:")); mCreateButton = new Button(_("Create"), "create", this); mCancelButton = new Button(_("Cancel"), "cancel", this); diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index c8a51e0e..1d06edd1 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -326,8 +326,8 @@ void ChatWindow::doPresent() } } - std::string cpc = strprintf(_("%d players are present."), playercount); - std::string log = _("Present: ") + response + std::string("; ") + cpc; + std::string log = strprintf(_("Present: %s; %d players are present."), + response.c_str(), playercount); if (mRecorder->isRecording()) { diff --git a/src/gui/connectiondialog.cpp b/src/gui/connectiondialog.cpp index 1c3b7ff5..9e361173 100644 --- a/src/gui/connectiondialog.cpp +++ b/src/gui/connectiondialog.cpp @@ -31,7 +31,7 @@ #include "utils/gettext.h" ConnectionDialog::ConnectionDialog(State previousState): - Window("Info"), mProgress(0), mPreviousState(previousState) + Window(_("Info")), mProgress(0), mPreviousState(previousState) { setContentSize(200, 100); diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 4f18421b..1ddadba4 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -32,10 +32,11 @@ #include "particle.h" #include "map.h" +#include "utils/gettext.h" #include "utils/stringutils.h" DebugWindow::DebugWindow(): - Window("Debug") + Window(_("Debug")) { setWindowName("Debug"); setupWindow->registerWindowForReset(this); @@ -45,19 +46,19 @@ DebugWindow::DebugWindow(): setSaveVisible(true); setDefaultSize(400, 100, ImageRect::CENTER); - mFPSLabel = new Label("0 FPS"); - mMusicFileLabel = new Label("Music: "); - mMapLabel = new Label("Map: "); - mMiniMapLabel = new Label("Mini-Map: "); - mTileMouseLabel = new Label("Mouse: 0, 0"); - mParticleCountLabel = new Label("Particle count: 0"); + mFPSLabel = new Label(strprintf(_("%d FPS"), 0)); + mMusicFileLabel = new Label(strprintf(_("Music: %s"), "")); + mMapLabel = new Label(strprintf(_("Map: %s"), "")); + mMinimapLabel = new Label(strprintf(_("Minimap: %s"), "")); + mTileMouseLabel = new Label(strprintf(_("Tile: (%d, %d)"), 0, 0)); + mParticleCountLabel = new Label(strprintf(_("Particle Count: %d"), 0)); place(0, 0, mFPSLabel, 3); place(3, 0, mTileMouseLabel); place(0, 1, mMusicFileLabel, 3); place(3, 1, mParticleCountLabel); place(0, 2, mMapLabel, 4); - place(0, 3, mMiniMapLabel, 4); + place(0, 3, mMinimapLabel, 4); loadWindowState(); } @@ -71,27 +72,28 @@ void DebugWindow::logic() int mouseTileX = (viewport->getMouseX() + viewport->getCameraX()) / 32; int mouseTileY = (viewport->getMouseY() + viewport->getCameraY()) / 32; - mFPSLabel->setCaption(toString(fps) + " FPS"); + mFPSLabel->setCaption(strprintf(_("%d FPS"), fps)); - mTileMouseLabel->setCaption("Tile: (" + toString(mouseTileX) + ", " + - toString(mouseTileY) + ")"); + mTileMouseLabel->setCaption(strprintf(_("Tile: (%d, %d)"), mouseTileX, + mouseTileY)); Map *currentMap = engine->getCurrentMap(); if (currentMap) { + // TODO: Add gettext support below const std::string music = "Music: " + currentMap->getProperty("music"); mMusicFileLabel->setCaption(music); const std::string minimap = - "MiniMap: " + currentMap->getProperty("minimap"); - mMiniMapLabel->setCaption(minimap); + "Minimap: " + currentMap->getProperty("minimap"); + mMinimapLabel->setCaption(minimap); const std::string map = "Map: " + currentMap->getProperty("_filename"); mMapLabel->setCaption(map); } - mParticleCountLabel->setCaption("Particle count: " + - toString(Particle::particleCount)); + mParticleCountLabel->setCaption(strprintf(_("Particle count: %d"), + Particle::particleCount)); } diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index e30107f9..e4c45bde 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -43,7 +43,7 @@ class DebugWindow : public Window void logic(); private: - gcn::Label *mMusicFileLabel, *mMapLabel, *mMiniMapLabel; + gcn::Label *mMusicFileLabel, *mMapLabel, *mMinimapLabel; gcn::Label *mTileMouseLabel, *mFPSLabel; gcn::Label *mParticleCountLabel; }; diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp index 87df46c1..20834c54 100644 --- a/src/gui/itemamount.cpp +++ b/src/gui/itemamount.cpp @@ -90,9 +90,9 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item, mItemIcon = new Icon(image); // Buttons - Button *minusButton = new Button("-", "minus", this); - Button *plusButton = new Button("+", "plus", this); - Button *okButton = new Button(_("Ok"), "ok", this); + Button *minusButton = new Button(_("-"), "dec", this); + Button *plusButton = new Button(_("+"), "inc", this); + Button *okButton = new Button(_("OK"), "ok", this); Button *cancelButton = new Button(_("Cancel"), "cancel", this); Button *addAllButton = new Button(_("All"), "all", this); @@ -172,11 +172,11 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event) { close(); } - else if (event.getId() == "plus" && amount < mMax) + else if (event.getId() == "inc" && amount < mMax) { amount++; } - else if (event.getId() == "minus" && amount > 1) + else if (event.getId() == "dec" && amount > 1) { amount--; } diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index b617be91..40526a22 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -48,7 +48,7 @@ Minimap::Minimap(): mWidthProportion(0.5), mHeightProportion(0.5) { - setWindowName("MiniMap"); + setWindowName("Minimap"); mShow = config.getValue(getWindowName() + "Show", true); setDefaultSize(5, 25, 100, 100); // set this to false as the minimap window size is changed diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 4e7c6f5a..186a99a9 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -93,8 +93,8 @@ NpcDialog::NpcDialog() mButton = new Button("", "ok", this); //Setup more and less buttons (int input) - mPlusButton = new Button("+", "plus", this); - mMinusButton = new Button("-", "minus", this); + mPlusButton = new Button(_("+"), "inc", this); + mMinusButton = new Button(_("-"), "dec", this); int width = std::max(mButton->getFont()->getWidth(CAPTION_WAITING), mButton->getFont()->getWidth(CAPTION_NEXT)); @@ -211,11 +211,11 @@ void NpcDialog::action(const gcn::ActionEvent &event) mIntField->setValue(mDefaultInt); } } - else if (event.getId() == "plus") + else if (event.getId() == "inc") { mIntField->setValue(mIntField->getValue() + 1); } - else if (event.getId() == "minus") + else if (event.getId() == "dec") { mIntField->setValue(mIntField->getValue() - 1); } diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 58bb1348..d2e9468d 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -58,9 +58,9 @@ OutfitWindow::OutfitWindow(): setCloseButton(true); setDefaultSize(250, 250, 118, 180); //160 - mPreviousButton = new Button("<", "previous", this); - mNextButton = new Button(">", "next", this); - mCurrentLabel = new Label("Outfit: 1"); + mPreviousButton = new Button(_("<"), "previous", this); + mNextButton = new Button(_(">"), "next", this); + mCurrentLabel = new Label(strprintf(_("Outfit: %d"), 1)); mCurrentLabel->setAlignment(gcn::Graphics::CENTER); mUnequipCheck = new CheckBox(_("Unequip first"), config.getValue("OutfitUnequip", true)); @@ -140,7 +140,7 @@ void OutfitWindow::action(const gcn::ActionEvent &event) mCurrentOutfit = 9; } } - mCurrentLabel->setCaption("Outfit: " + toString(mCurrentOutfit + 1)); + mCurrentLabel->setCaption(strprintf(_("Outfit: %d"), mCurrentOutfit + 1)); } void OutfitWindow::wearOutfit(int outfit) diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 54cf514f..4082b881 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -69,8 +69,8 @@ SellDialog::SellDialog(): mMoneyLabel = new Label(strprintf(_("Price: %s / Total: %s"), "", "")); - mIncreaseButton = new Button("+", "+", this); - mDecreaseButton = new Button("-", "-", this); + mIncreaseButton = new Button(_("+"), "inc", this); + mDecreaseButton = new Button(_("-"), "dec", this); mSellButton = new Button(_("Sell"), "sell", this); mQuitButton = new Button(_("Quit"), "quit", this); mAddMaxButton = new Button(_("Max"), "max", this); @@ -161,13 +161,13 @@ void SellDialog::action(const gcn::ActionEvent &event) mAmountItems = (int) mSlider->getValue(); updateButtonsAndLabels(); } - else if (event.getId() == "+" && mAmountItems < mMaxItems) + else if (event.getId() == "inc" && mAmountItems < mMaxItems) { mAmountItems++; mSlider->setValue(mAmountItems); updateButtonsAndLabels(); } - else if (event.getId() == "-" && mAmountItems > 1) + else if (event.getId() == "dec" && mAmountItems > 1) { mAmountItems--; mSlider->setValue(mAmountItems); diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 5d08a2ec..bd6b7d4b 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -71,7 +71,7 @@ void ServersListModel::addElement(Server server) } ServerDialog::ServerDialog(LoginData *loginData): - Window(_("Choose your server")), mLoginData(loginData) + Window(_("Choose Your Server")), mLoginData(loginData) { gcn::Label *serverLabel = new Label(_("Server:")); gcn::Label *portLabel = new Label(_("Port:")); diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 4ada5c59..a27a2775 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -258,7 +258,7 @@ SkillEntry::SkillEntry(SkillInfo *info) : mIcon(NULL), mNameLabel(new Label(info->name)), mLevelLabel(new Label("999")), - mIncrease(new Button("+", "inc", skillDialog)), + mIncrease(new Button(_("+"), "inc", skillDialog)), mProgress(new ProgressBar(0.0f, 200, 20, gcn::Color(150, 150, 150))) { setFrameSize(1); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 4d8ce840..0108ee11 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -100,10 +100,10 @@ StatusWindow::StatusWindow(): // Status Part // ---------------------- - mLvlLabel = new Label("Level:"); - mMoneyLabel = new Label("Money:"); + mLvlLabel = new Label(strprintf(_("Level: %d"), 0)); + mMoneyLabel = new Label(strprintf(_("Money: %s"), "")); - mHpLabel = new Label("HP:"); + mHpLabel = new Label(_("HP:")); mHpBar = new ProgressBar((float) player_node->getHp() / (float) player_node->getMaxHp(), 80, 15, gcn::Color(0, 171, 34)); @@ -463,8 +463,8 @@ ChangeDisplay::ChangeDisplay(int id, const std::string &name): AttrDisplay(id, name), mNeeded(1) { mPoints = new Label("1"); - mDec = new Button("-", "-", this); - mInc = new Button("+", "+", this); + mDec = new Button(_("-"), "dec", this); + mInc = new Button(_("+"), "inc", this); mDec->setWidth(mInc->getWidth()); // Do the layout diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp index 32bc732f..be54453d 100644 --- a/src/gui/unregisterdialog.cpp +++ b/src/gui/unregisterdialog.cpp @@ -42,7 +42,7 @@ #include UnRegisterDialog::UnRegisterDialog(Window *parent, LoginData *loginData): - Window("Unregister", true, parent), + Window(_("Unregister"), true, parent), mWrongDataNoticeListener(new WrongDataNoticeListener), mLoginData(loginData) { diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index d2fa33b8..e3ba4874 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -143,7 +143,7 @@ void ChatTab::chatLog(std::string line, int own, bool ignoreRecord) lineColor = "##2"; // Equiv. to BrowserBox::GREEN break; case ACT_WHISPER: - tmp.nick = strprintf(_("%s whispers: "), tmp.nick.c_str()); + tmp.nick = strprintf(_("%s whispers: %s"), tmp.nick.c_str(), ""); lineColor = "##W"; break; case ACT_IS: diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 3528eeee..3bc11b83 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -318,9 +318,9 @@ void PlayerHandler::handleMessage(MessageIn &msg) int curGp = player_node->getMoney(); player_node->setMoney(msg.readInt32()); if (player_node->getMoney() > curGp) - localChatTab->chatLog(_("You picked up ") + + localChatTab->chatLog(strprintf(_("You picked up %s"), Units::formatCurrency(player_node->getMoney() - - curGp), BY_SERVER); + - curGp).c_str()), BY_SERVER); } break; case 0x0016: diff --git a/src/net/tmwserv/beinghandler.cpp b/src/net/tmwserv/beinghandler.cpp index 7076ff8e..fc24a0ae 100644 --- a/src/net/tmwserv/beinghandler.cpp +++ b/src/net/tmwserv/beinghandler.cpp @@ -321,8 +321,8 @@ void BeingHandler::handleBeingActionChangeMessage(MessageIn &msg) }; std::string message(deadMsg[rand()%13]); - message.append(_(" Press OK to respawn")); - OkDialog *dlg = new OkDialog(_("You died"), message); + message.append(" " + _("Press OK to respawn.")); + OkDialog *dlg = new OkDialog(_("You Died"), message); dlg->addActionListener(&(Net::GameServer::Player::respawnListener)); } } -- cgit v1.2.3-70-g09d2