summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp34
-rw-r--r--src/gui/char_select.cpp63
-rw-r--r--src/gui/char_server.cpp8
-rw-r--r--src/gui/confirm_dialog.cpp5
-rw-r--r--src/gui/connection.cpp6
-rw-r--r--src/gui/equipmentwindow.cpp4
-rw-r--r--src/gui/inventorywindow.cpp51
-rw-r--r--src/gui/item_amount.cpp34
-rw-r--r--src/gui/login.cpp20
-rw-r--r--src/gui/menuwindow.cpp18
-rw-r--r--src/gui/minimap.cpp4
-rw-r--r--src/gui/npc_text.cpp6
-rw-r--r--src/gui/npclistdialog.cpp8
-rw-r--r--src/gui/ok_dialog.cpp4
-rw-r--r--src/gui/popupmenu.cpp29
-rw-r--r--src/gui/register.cpp51
-rw-r--r--src/gui/sell.cpp41
-rw-r--r--src/gui/setup.cpp18
-rw-r--r--src/gui/setup_audio.cpp8
-rw-r--r--src/gui/setup_joystick.cpp18
-rw-r--r--src/gui/setup_video.cpp55
-rw-r--r--src/gui/trade.cpp43
22 files changed, 282 insertions, 246 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 714f52db..c1e5a272 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -34,10 +34,11 @@
#include "../net/messageout.h"
#include "../net/protocol.h"
-#include "../utils/tostring.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
BuyDialog::BuyDialog(Network *network):
- Window("Buy"), mNetwork(network),
+ Window(_("Buy")), mNetwork(network),
mMoney(0), mAmountItems(0), mMaxItems(0)
{
setWindowName("Buy");
@@ -52,13 +53,13 @@ BuyDialog::BuyDialog(Network *network):
mScrollArea = new ScrollArea(mShopItemList);
mSlider = new Slider(1.0);
mQuantityLabel = new gcn::Label("0");
- mMoneyLabel = new gcn::Label("Price : 0 GP / 0 GP");
+ mMoneyLabel = new gcn::Label(strprintf(_("Price: %d GP / Total: %d GP"), 0, 0));
mIncreaseButton = new Button("+", "+", this);
mDecreaseButton = new Button("-", "-", this);
- mBuyButton = new Button("Buy", "buy", this);
- mQuitButton = new Button("Quit", "quit", this);
- mItemDescLabel = new gcn::Label("Description:");
- mItemEffectLabel = new gcn::Label("Effect:");
+ mBuyButton = new Button(_("Buy"), "buy", this);
+ mQuitButton = new Button(_("Quit"), "quit", this);
+ mItemDescLabel = new gcn::Label(strprintf(_("Description: %s"), ""));
+ mItemEffectLabel = new gcn::Label(strprintf(_("Effect: %s"), ""));
mIncreaseButton->setSize(20, 20);
mDecreaseButton->setSize(20, 20);
@@ -159,7 +160,7 @@ void BuyDialog::action(const gcn::ActionEvent &event)
}
// TODO: Actually we'd have a bug elsewhere if this check for the number
// of items to be bought ever fails, Bertram removed the assertions, is
- // there a better way to ensure this fails in an _obivous_ way in C++?
+ // there a better way to ensure this fails in an _obvious_ way in C++?
else if (event.getId() == "buy" && mAmountItems > 0 &&
mAmountItems <= mMaxItems)
{
@@ -246,8 +247,10 @@ BuyDialog::updateButtonsAndLabels()
{
const ItemInfo &info = mShopItems->at(selectedItem)->getInfo();
- mItemDescLabel->setCaption("Description: " + info.getDescription());
- mItemEffectLabel->setCaption("Effect: " + info.getEffect());
+ mItemDescLabel->setCaption
+ (strprintf(_("Description: %s"), info.getDescription().c_str()));
+ mItemEffectLabel->setCaption
+ (strprintf(_("Effect: %s"), info.getEffect().c_str()));
int itemPrice = mShopItems->at(selectedItem)->getPrice();
@@ -263,8 +266,8 @@ BuyDialog::updateButtonsAndLabels()
}
else
{
- mItemDescLabel->setCaption("Description:");
- mItemEffectLabel->setCaption("Effect:");
+ mItemDescLabel->setCaption(strprintf(_("Description: %s"), ""));
+ mItemEffectLabel->setCaption(strprintf(_("Effect: %s"), ""));
mMaxItems = 0;
mAmountItems = 0;
}
@@ -276,8 +279,7 @@ BuyDialog::updateButtonsAndLabels()
mSlider->setEnabled(mMaxItems > 1);
// Update quantity and money labels
- mQuantityLabel->setCaption(
- toString(mAmountItems) + " / " + toString(mMaxItems));
- mMoneyLabel->setCaption("Price: " + toString(price) + " GP / "
- + toString(mMoney - price) + " GP" );
+ mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems));
+ mMoneyLabel->setCaption
+ (strprintf(_("Price: %d GP / Total: %d GP"), price, mMoney - price));
}
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 7c067eef..65dafeea 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -38,7 +38,8 @@
#include "../net/charserverhandler.h"
#include "../net/messageout.h"
-#include "../utils/tostring.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
#include "../utils/trim.h"
// Defined in main.cpp, used here for setting the char create dialog
@@ -57,8 +58,8 @@ class CharDeleteConfirm : public ConfirmDialog
};
CharDeleteConfirm::CharDeleteConfirm(CharSelectDialog *m):
- ConfirmDialog("Confirm", "Are you sure you want to delete this character?",
- m),
+ ConfirmDialog(_("Confirm Character Delete"),
+ _("Are you sure you want to delete this character?"), m),
master(m)
{
}
@@ -75,21 +76,23 @@ void CharDeleteConfirm::action(const gcn::ActionEvent &event)
CharSelectDialog::CharSelectDialog(Network *network,
LockedArray<LocalPlayer*> *charInfo,
Gender gender):
- Window("Select Character"), mNetwork(network),
+ Window(_("Select Character")), mNetwork(network),
mCharInfo(charInfo), mGender(gender), mCharSelected(false)
{
- mSelectButton = new Button("Ok", "ok", this);
- mCancelButton = new Button("Cancel", "cancel", this);
- mNewCharButton = new Button("New", "new", this);
- mDelCharButton = new Button("Delete", "delete", this);
- mPreviousButton = new Button("Previous", "previous", this);
- mNextButton = new Button("Next", "next", this);
-
- mNameLabel = new gcn::Label("Name");
- mLevelLabel = new gcn::Label("Level");
- mJobLevelLabel = new gcn::Label("Job Level");
- mMoneyLabel = new gcn::Label("Money");
- mPlayerBox = new PlayerBox();
+ mSelectButton = new Button(_("Ok"), "ok", this);
+ mCancelButton = new Button(_("Cancel"), "cancel", this);
+ mNewCharButton = new Button(_("New"), "new", this);
+ mDelCharButton = new Button(_("Delete"), "delete", this);
+ mPreviousButton = new Button(_("Previous"), "previous", this);
+ mNextButton = new Button(_("Next"), "next", this);
+
+ mNameLabel = new gcn::Label(strprintf(_("Name: %s"), ""));
+ mLevelLabel = new gcn::Label(strprintf(_("Level: %d"), 0));
+ mJobLevelLabel = new gcn::Label(strprintf(_("Job Level: %d"), 0));
+ mMoneyLabel = new gcn::Label(strprintf(_("Money: %d"), 0));
+
+ // Control that shows the Player
+ mPlayerBox = new PlayerBox;
int w = 195;
int h = 220;
@@ -178,10 +181,10 @@ void CharSelectDialog::updatePlayerInfo()
if (pi)
{
- mNameLabel->setCaption(pi->getName());
- mLevelLabel->setCaption("Lvl: " + toString(pi->mLevel));
- mJobLevelLabel->setCaption("Job Lvl: " + toString(pi->mJobLevel));
- mMoneyLabel->setCaption("Gold: " + toString(pi->mGp));
+ mNameLabel->setCaption(strprintf(_("Name: %s"), pi->getName().c_str()));
+ mLevelLabel->setCaption(strprintf(_("Level: %d"), pi->mLevel));
+ mJobLevelLabel->setCaption(strprintf(_("Job Level: %d"), pi->mJobLevel));
+ mMoneyLabel->setCaption(strprintf(_("Gold: %d"), pi->mGp));
if (!mCharSelected)
{
mNewCharButton->setEnabled(false);
@@ -190,10 +193,10 @@ void CharSelectDialog::updatePlayerInfo()
}
}
else {
- mNameLabel->setCaption("Name");
- mLevelLabel->setCaption("Level");
- mJobLevelLabel->setCaption("Job Level");
- mMoneyLabel->setCaption("Money");
+ mNameLabel->setCaption(strprintf(_("Name: %s"), ""));
+ mLevelLabel->setCaption(strprintf(_("Level: %d"), 0));
+ mJobLevelLabel->setCaption(strprintf(_("Job Level: %d"), 0));
+ mMoneyLabel->setCaption(strprintf(_("Money: %d"), 0));
mNewCharButton->setEnabled(true);
mDelCharButton->setEnabled(false);
mSelectButton->setEnabled(false);
@@ -250,22 +253,22 @@ bool CharSelectDialog::selectByName(const std::string &name)
CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network,
Gender gender):
- Window("Create Character", true, parent), mNetwork(network), mSlot(slot)
+ Window(_("Create Character"), true, parent), mNetwork(network), mSlot(slot)
{
mPlayer = new Player(0, 0, NULL);
mPlayer->setGender(gender);
mPlayer->setHairStyle(rand() % Being::getHairStylesNr(), rand() % Being::getHairColorsNr());
mNameField = new TextField("");
- mNameLabel = new gcn::Label("Name:");
+ mNameLabel = new gcn::Label(_("Name:"));
mNextHairColorButton = new Button(">", "nextcolor", this);
mPrevHairColorButton = new Button("<", "prevcolor", this);
- mHairColorLabel = new gcn::Label("Hair Color:");
+ mHairColorLabel = new gcn::Label(_("Hair Color:"));
mNextHairStyleButton = new Button(">", "nextstyle", this);
mPrevHairStyleButton = new Button("<", "prevstyle", this);
- mHairStyleLabel = new gcn::Label("Hair Style:");
- mCreateButton = new Button("Create", "create", this);
- mCancelButton = new Button("Cancel", "cancel", this);
+ mHairStyleLabel = new gcn::Label(_("Hair Style:"));
+ mCreateButton = new Button(_("Create"), "create", this);
+ mCancelButton = new Button(_("Cancel"), "cancel", this);
mPlayerBox = new PlayerBox(mPlayer);
mNameField->setActionEventId("create");
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index ce068ad1..3d3309fb 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -31,6 +31,8 @@
#include "../net/network.h" // TODO this is just for iptostring, move that?
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
#include "../utils/tostring.h"
extern SERVER_INFO **server_info;
@@ -47,15 +49,15 @@ class ServerListModel : public gcn::ListModel {
};
ServerSelectDialog::ServerSelectDialog(LoginData *loginData, int nextState):
- Window("Select Server"),
+ Window(_("Select Server")),
mLoginData(loginData),
mNextState(nextState)
{
mServerListModel = new ServerListModel();
mServerList = new ListBox(mServerListModel);
ScrollArea *mScrollArea = new ScrollArea(mServerList);
- mOkButton = new Button("OK", "ok", this);
- Button *mCancelButton = new Button("Cancel", "cancel", this);
+ mOkButton = new Button(_("OK"), "ok", this);
+ Button *mCancelButton = new Button(_("Cancel"), "cancel", this);
setContentSize(200, 100);
diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp
index 9ef94f62..5f2b9cb2 100644
--- a/src/gui/confirm_dialog.cpp
+++ b/src/gui/confirm_dialog.cpp
@@ -25,14 +25,15 @@
#include "button.h"
+#include "../utils/gettext.h"
ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
Window *parent):
Window(title, true, parent)
{
gcn::Label *textLabel = new gcn::Label(msg);
- gcn::Button *yesButton = new Button("Yes", "yes", this);
- gcn::Button *noButton = new Button("No", "no", this);
+ gcn::Button *yesButton = new Button(_("Yes"), "yes", this);
+ gcn::Button *noButton = new Button(_("No"), "no", this);
int w = textLabel->getWidth() + 20;
int inWidth = yesButton->getWidth() + noButton->getWidth() + 5;
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp
index 8ad3b436..0f43ff14 100644
--- a/src/gui/connection.cpp
+++ b/src/gui/connection.cpp
@@ -30,6 +30,8 @@
#include "../main.h"
+#include "../utils/gettext.h"
+
namespace {
struct ConnectionActionListener : public gcn::ActionListener
{
@@ -42,9 +44,9 @@ ConnectionDialog::ConnectionDialog():
{
setContentSize(200, 100);
- Button *cancelButton = new Button("Cancel", "cancelButton", &listener);
+ Button *cancelButton = new Button(_("Cancel"), "cancelButton", &listener);
mProgressBar = new ProgressBar(0.0, 200 - 10, 20, 128, 128, 128);
- gcn::Label *label = new gcn::Label("Connecting...");
+ gcn::Label *label = new gcn::Label(_("Connecting..."));
cancelButton->setPosition(5, 100 - 5 - cancelButton->getHeight());
mProgressBar->setPosition(5, cancelButton->getY() - 25);
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 762ca8e8..f3a143be 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -31,10 +31,12 @@
#include "../resources/iteminfo.h"
#include "../resources/resourcemanager.h"
+#include "../utils/gettext.h"
#include "../utils/tostring.h"
EquipmentWindow::EquipmentWindow(Equipment *equipment):
- Window("Equipment"), mEquipment(equipment)
+ Window(_("Equipment")),
+ mEquipment(equipment)
{
setWindowName("Equipment");
setCloseButton(true);
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 0e1c5291..ac368aa7 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -39,10 +39,11 @@
#include "../resources/iteminfo.h"
-#include "../utils/tostring.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
InventoryWindow::InventoryWindow():
- Window("Inventory")
+ Window(_("Inventory"))
{
setWindowName("Inventory");
setResizable(true);
@@ -52,8 +53,8 @@ InventoryWindow::InventoryWindow():
// If you adjust these defaults, don't forget to adjust the trade window's.
setDefaultSize(115, 25, 322, 200);
- mUseButton = new Button("Use", "use", this);
- mDropButton = new Button("Drop", "drop", this);
+ mUseButton = new Button(_("Use"), "use", this);
+ mDropButton = new Button(_("Drop"), "drop", this);
mItems = new ItemContainer(player_node->getInventory());
mItems->addSelectionListener(this);
@@ -95,15 +96,14 @@ void InventoryWindow::logic()
updateButtons();
// Update weight information
- mWeightLabel->setCaption(
- "Weight: " + toString(player_node->mTotalWeight) +
- "/" + toString(player_node->mMaxWeight));
+ mWeightLabel->setCaption(strprintf(_("Weight: %d / %d"),
+ player_node->mTotalWeight,
+ player_node->mMaxWeight));
// Update number of items in inventory
- mInvenSlotLabel->setCaption(
- "Slots used: "
- + toString(player_node->getInventory()->getNumberOfSlotsUsed())
- + "/" + toString(player_node->getInventory()->getInventorySize()));
+ mInvenSlotLabel->setCaption(strprintf(_("Slots used: %d / %d"),
+ player_node->getInventory()->getNumberOfSlotsUsed(),
+ player_node->getInventory()->getInventorySize()));
}
void InventoryWindow::action(const gcn::ActionEvent &event)
@@ -145,20 +145,20 @@ void InventoryWindow::valueChanged(const gcn::SelectionEvent &event)
// Update name, effect and description
if (!item)
{
- mItemNameLabel->setCaption("Name:");
- mItemEffectLabel->setCaption("Effect:");
- mItemDescriptionLabel->setCaption("Description:");
+ mItemNameLabel->setCaption(strprintf(_("Name: %s"), ""));
+ mItemEffectLabel->setCaption(strprintf(_("Effect: %s"), ""));
+ mItemDescriptionLabel->setCaption(strprintf(_("Description: %s"), ""));
}
else
{
const ItemInfo& itemInfo = item->getInfo();
- std::string SomeText;
- SomeText = "Name: " + itemInfo.getName();
- mItemNameLabel->setCaption(SomeText);
- SomeText = "Effect: " + itemInfo.getEffect();
- mItemEffectLabel->setCaption(SomeText);
- SomeText = "Description: " + itemInfo.getDescription();
- mItemDescriptionLabel->setCaption(SomeText);
+ mItemNameLabel->setCaption(
+ strprintf(_("Name: %s"), itemInfo.getName().c_str()));
+ mItemEffectLabel->setCaption(
+ strprintf(_("Effect: %s"), itemInfo.getEffect().c_str()));
+ mItemDescriptionLabel->setCaption(
+ strprintf(_("Description: %s"),
+ itemInfo.getDescription().c_str()));
}
}
@@ -170,7 +170,8 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
{
Item *item = mItems->getSelectedItem();
- if (!item) return;
+ if (!item)
+ return;
/* Convert relative to the window coordinates to absolute screen
* coordinates.
@@ -221,14 +222,14 @@ void InventoryWindow::updateButtons()
if (selectedItem && selectedItem->isEquipment())
{
if (selectedItem->isEquipped()) {
- mUseButton->setCaption("Unequip");
+ mUseButton->setCaption(_("Unequip"));
}
else {
- mUseButton->setCaption("Equip");
+ mUseButton->setCaption(_("Equip"));
}
}
else {
- mUseButton->setCaption("Use");
+ mUseButton->setCaption(_("Use"));
}
mUseButton->setEnabled(selectedItem != 0);
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index 2e8941e8..064c8f93 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -29,31 +29,33 @@
#include "../item.h"
#include "../localplayer.h"
+#include "../utils/gettext.h"
+
ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item):
- Window("Select amount of items to drop.", true, parent),
+ Window("", true, parent),
mItem(item)
{
- // New labels
+ // Integer field
mItemAmountTextBox = new IntTextBox(1);
-
- // New buttons
- Button *minusButton = new Button("-", "Minus", this);
- Button *plusButton = new Button("+", "Plus", this);
- Button *okButton = new Button("Okay", "Drop", this);
- Button *cancelButton = new Button("Cancel", "Cancel", this);
- mItemAmountSlide = new Slider(1.0, mItem->getQuantity());
-
mItemAmountTextBox->setRange(1, mItem->getQuantity());
- mItemAmountSlide->setDimension(gcn::Rectangle(5, 120, 180, 10));
- // Set button events Id
+ // Slider
+ mItemAmountSlide = new Slider(1.0, mItem->getQuantity());
mItemAmountSlide->setActionEventId("Slide");
+ mItemAmountSlide->addActionListener(this);
+
+ // Buttons
+ Button *minusButton = new Button("-", "Minus", this);
+ Button *plusButton = new Button("+", "Plus", this);
+ Button *okButton = new Button(_("Ok"), "Drop", this);
+ Button *cancelButton = new Button(_("Cancel"), "Cancel", this);
- // Set position
+ // Set positions
mItemAmountTextBox->setPosition(35, 10);
mItemAmountTextBox->setSize(24, 16);
plusButton->setPosition(60, 5);
minusButton->setPosition(10, 5);
+ mItemAmountSlide->setDimension(gcn::Rectangle(5, 120, 180, 10));
mItemAmountSlide->setPosition(10, 35);
okButton->setPosition(10, 50);
cancelButton->setPosition(60, 50);
@@ -66,17 +68,15 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item):
add(okButton);
add(cancelButton);
- mItemAmountSlide->addActionListener(this);
-
resetAmount();
switch (usage) {
case AMOUNT_TRADE_ADD:
- setCaption("Select amount of items to trade.");
+ setCaption(_("Select amount of items to trade."));
okButton->setActionEventId("AddTrade");
break;
case AMOUNT_ITEM_DROP:
- setCaption("Select amount of items to drop.");
+ setCaption(_("Select amount of items to drop."));
okButton->setActionEventId("Drop");
break;
default:
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 06a5f9f0..5a748b52 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -34,21 +34,23 @@
#include "passwordfield.h"
#include "textfield.h"
+#include "../utils/gettext.h"
+
LoginDialog::LoginDialog(LoginData *loginData):
- Window("Login"), mLoginData(loginData)
+ Window(_("Login")), mLoginData(loginData)
{
- gcn::Label *userLabel = new gcn::Label("Name:");
- gcn::Label *passLabel = new gcn::Label("Password:");
- gcn::Label *serverLabel = new gcn::Label("Server:");
+ gcn::Label *userLabel = new gcn::Label(_("Name:"));
+ gcn::Label *passLabel = new gcn::Label(_("Password:"));
+ gcn::Label *serverLabel = new gcn::Label(_("Server:"));
mUserField = new TextField(mLoginData->username);
mPassField = new PasswordField(mLoginData->password);
mServerField = new TextField(mLoginData->hostname);
- mKeepCheck = new CheckBox("Keep", mLoginData->remember);
- mOkButton = new Button("OK", "ok", this);
- mCancelButton = new Button("Cancel", "cancel", this);
- mRegisterButton = new Button("Register", "register", this);
+ mKeepCheck = new CheckBox(_("Remember Username"), mLoginData->remember);
+ mOkButton = new Button(_("Ok"), "ok", this);
+ mCancelButton = new Button(_("Cancel"), "cancel", this);
+ mRegisterButton = new Button(_("Register"), "register", this);
- const int width = 220;
+ const int width = 250;
const int height = 100;
setContentSize(width, height);
diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp
index 3c3e4ab8..0893cb1c 100644
--- a/src/gui/menuwindow.cpp
+++ b/src/gui/menuwindow.cpp
@@ -28,6 +28,8 @@
#include "button.h"
#include "windowcontainer.h"
+#include "../utils/gettext.h"
+
extern Window *setupWindow;
extern Window *inventoryWindow;
extern Window *equipmentWindow;
@@ -54,21 +56,21 @@ MenuWindow::MenuWindow():
setTitleBarHeight(0);
// Buttons
- const char *buttonNames[] =
+ static const char *buttonNames[] =
{
- "Status",
- "Equipment",
- "Inventory",
- "Skills",
- "Shortcut",
- "Setup",
+ N_("Status"),
+ N_("Equipment"),
+ N_("Inventory"),
+ N_("Skills"),
+ N_("Shortcut"),
+ N_("Setup"),
0
};
int x = 0, h = 0;
for (const char **curBtn = buttonNames; *curBtn; curBtn++)
{
- gcn::Button *btn = new Button(*curBtn, *curBtn, &listener);
+ gcn::Button *btn = new Button(gettext(*curBtn), *curBtn, &listener);
btn->setPosition(x, 0);
add(btn);
x += btn->getWidth() + 3;
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 231c749f..55132d6d 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -28,8 +28,10 @@
#include "../resources/image.h"
+#include "../utils/gettext.h"
+
Minimap::Minimap():
- Window("Map"),
+ Window(_("MiniMap")),
mMapImage(NULL)
{
setWindowName("MiniMap");
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index 34c9cce1..c9ace303 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -29,8 +29,10 @@
#include "../npc.h"
+#include "../utils/gettext.h"
+
NpcTextDialog::NpcTextDialog():
- Window("NPC")
+ Window(_("NPC"))
{
setResizable(true);
@@ -41,7 +43,7 @@ NpcTextDialog::NpcTextDialog():
mTextBox->setEditable(false);
scrollArea = new ScrollArea(mTextBox);
- okButton = new Button("OK", "ok", this);
+ okButton = new Button(_("OK"), "ok", this);
setContentSize(260, 175);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index cdd38312..bff6994d 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -29,8 +29,10 @@
#include "../npc.h"
+#include "../utils/gettext.h"
+
NpcListDialog::NpcListDialog():
- Window("NPC")
+ Window(_("NPC"))
{
setResizable(true);
@@ -39,8 +41,8 @@ NpcListDialog::NpcListDialog():
mItemList = new ListBox(this);
scrollArea = new ScrollArea(mItemList);
- okButton = new Button("OK", "ok", this);
- cancelButton = new Button("Cancel", "cancel", this);
+ okButton = new Button(_("OK"), "ok", this);
+ cancelButton = new Button(_("Cancel"), "cancel", this);
setContentSize(260, 175);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp
index d43c8e69..9db3cd7b 100644
--- a/src/gui/ok_dialog.cpp
+++ b/src/gui/ok_dialog.cpp
@@ -24,6 +24,8 @@
#include "button.h"
#include "scrollarea.h"
+#include "../utils/gettext.h"
+
OkDialog::OkDialog(const std::string &title, const std::string &msg,
Window *parent):
Window(title, true, parent)
@@ -32,7 +34,7 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg,
textBox->setEditable(false);
gcn::ScrollArea *scrollArea = new ScrollArea(textBox);
- gcn::Button *okButton = new Button("Ok", "ok", this);
+ gcn::Button *okButton = new Button(_("Ok"), "ok", this);
setContentSize(260, 175);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 07719d2c..bfa75ef9 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -42,6 +42,9 @@
#include "../resources/iteminfo.h"
#include "../resources/itemdb.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
+
extern std::string tradePartnerName;
PopupMenu::PopupMenu():
@@ -74,8 +77,10 @@ void PopupMenu::showPopup(int x, int y, Being *being)
// Players can be traded with. Later also attack, follow and
// add as buddy will be options in this menu.
const std::string &name = being->getName();
- mBrowserBox->addRow("@@trade|Trade With " + name + "@@");
- mBrowserBox->addRow("@@attack|Attack " + name + "@@");
+ mBrowserBox->addRow(
+ strprintf(_("@@trade|Trade With %s@@"), name.c_str()));
+ mBrowserBox->addRow(
+ strprintf(_("@@attack|Attack %s@@"), name.c_str()));
mBrowserBox->addRow("##3---");
@@ -106,7 +111,7 @@ void PopupMenu::showPopup(int x, int y, Being *being)
case Being::NPC:
// NPCs can be talked to (single option, candidate for removal
// unless more options would be added)
- mBrowserBox->addRow("@@talk|Talk To NPC@@");
+ mBrowserBox->addRow(_("@@talk|Talk To NPC@@"));
break;
default:
@@ -116,7 +121,7 @@ void PopupMenu::showPopup(int x, int y, Being *being)
//browserBox->addRow("@@look|Look To@@");
mBrowserBox->addRow("##3---");
- mBrowserBox->addRow("@@cancel|Cancel@@");
+ mBrowserBox->addRow(_("@@cancel|Cancel@@"));
showPopup(x, y);
}
@@ -128,11 +133,11 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem)
// Floor item can be picked up (single option, candidate for removal)
std::string name = ItemDB::get(mFloorItem->getItemId()).getName();
- mBrowserBox->addRow("@@pickup|Pick Up " + name + "@@");
+ mBrowserBox->addRow(strprintf(_("@@pickup|Pick Up %s@@"), name.c_str()));
//browserBox->addRow("@@look|Look To@@");
mBrowserBox->addRow("##3---");
- mBrowserBox->addRow("@@cancel|Cancel@@");
+ mBrowserBox->addRow(_("@@cancel|Cancel@@"));
showPopup(x, y);
}
@@ -275,17 +280,17 @@ void PopupMenu::showPopup(int x, int y, Item *item)
if (item->isEquipment())
{
if (item->isEquipped())
- mBrowserBox->addRow("@@use|Unequip@@");
+ mBrowserBox->addRow(_("@@use|Unequip@@"));
else
- mBrowserBox->addRow("@@use|Equip@@");
+ mBrowserBox->addRow(_("@@use|Equip@@"));
}
else
- mBrowserBox->addRow("@@use|Use@@");
+ mBrowserBox->addRow(_("@@use|Use@@"));
- mBrowserBox->addRow("@@drop|Drop@@");
- mBrowserBox->addRow("@@description|Description@@");
+ mBrowserBox->addRow(_("@@drop|Drop@@"));
+ mBrowserBox->addRow(_("@@description|Description@@"));
mBrowserBox->addRow("##3---");
- mBrowserBox->addRow("@@cancel|Cancel@@");
+ mBrowserBox->addRow(_("@@cancel|Cancel@@"));
showPopup(x, y);
}
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 2a97a3e5..ce36efa2 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -39,6 +39,9 @@
#include "textfield.h"
#include "ok_dialog.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
+
void
WrongDataNoticeListener::setTarget(gcn::TextField *textField)
{
@@ -59,18 +62,18 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
mWrongDataNoticeListener(new WrongDataNoticeListener()),
mLoginData(loginData)
{
- gcn::Label *userLabel = new gcn::Label("Name:");
- gcn::Label *passwordLabel = new gcn::Label("Password:");
- gcn::Label *confirmLabel = new gcn::Label("Confirm:");
- gcn::Label *serverLabel = new gcn::Label("Server:");
+ gcn::Label *userLabel = new gcn::Label(_("Name:"));
+ gcn::Label *passwordLabel = new gcn::Label(_("Password:"));
+ gcn::Label *confirmLabel = new gcn::Label(_("Confirm:"));
+ gcn::Label *serverLabel = new gcn::Label(_("Server:"));
mUserField = new TextField(loginData->username);
mPasswordField = new PasswordField(loginData->password);
mConfirmField = new PasswordField();
mServerField = new TextField(loginData->hostname);
- mMaleButton = new RadioButton("Male", "sex", true);
- mFemaleButton = new RadioButton("Female", "sex", false);
- mRegisterButton = new Button("Register", "register", this);
- mCancelButton = new Button("Cancel", "cancel", this);
+ mMaleButton = new RadioButton(_("Male"), "sex", true);
+ mFemaleButton = new RadioButton(_("Female"), "sex", false);
+ mRegisterButton = new Button(_("Register"), "register", this);
+ mCancelButton = new Button(_("Cancel"), "cancel", this);
const int width = 220;
const int height = 150;
@@ -163,45 +166,45 @@ RegisterDialog::action(const gcn::ActionEvent &event)
const std::string user = mUserField->getText();
logger->log("RegisterDialog::register Username is %s", user.c_str());
- std::stringstream errorMsg;
+ std::string errorMsg;
int error = 0;
if (user.length() < LEN_MIN_USERNAME)
{
// Name too short
- errorMsg << "The username needs to be at least "
- << LEN_MIN_USERNAME
- << " characters long.";
+ errorMsg = strprintf
+ (_("The username needs to be at least %d characters long."),
+ LEN_MIN_USERNAME);
error = 1;
}
else if (user.length() > LEN_MAX_USERNAME - 1 )
{
// Name too long
- errorMsg << "The username needs to be less than "
- << LEN_MAX_USERNAME
- << " characters long.";
+ errorMsg = strprintf
+ (_("The username needs to be less than %d characters long."),
+ LEN_MAX_USERNAME);
error = 1;
}
else if (mPasswordField->getText().length() < LEN_MIN_PASSWORD)
{
// Pass too short
- errorMsg << "The password needs to be at least "
- << LEN_MIN_PASSWORD
- << " characters long.";
+ errorMsg = strprintf
+ (_("The password needs to be at least %d characters long."),
+ LEN_MIN_PASSWORD);
error = 2;
}
else if (mPasswordField->getText().length() > LEN_MAX_PASSWORD - 1 )
{
// Pass too long
- errorMsg << "The password needs to be less than "
- << LEN_MAX_PASSWORD
- << " characters long.";
+ errorMsg = strprintf
+ (_("The password needs to be less than %d characters long."),
+ LEN_MAX_PASSWORD);
error = 2;
}
else if (mPasswordField->getText() != mConfirmField->getText())
{
// Password does not match with the confirmation one
- errorMsg << "Passwords do not match.";
+ errorMsg = _("Passwords do not match.");
error = 2;
}
@@ -220,8 +223,8 @@ RegisterDialog::action(const gcn::ActionEvent &event)
mWrongDataNoticeListener->setTarget(this->mPasswordField);
}
- OkDialog *mWrongRegisterNotice = new OkDialog("Error",
- errorMsg.str());
+ OkDialog *mWrongRegisterNotice =
+ new OkDialog(_("Error"), errorMsg);
mWrongRegisterNotice->addActionListener(mWrongDataNoticeListener);
}
else
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 6df1cbf6..7a2e94c6 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -39,10 +39,11 @@
#include "../net/messageout.h"
#include "../net/protocol.h"
-#include "../utils/tostring.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
SellDialog::SellDialog(Network *network):
- Window("Sell"),
+ Window(_("Sell")),
mNetwork(network),
mMaxItems(0), mAmountItems(0)
{
@@ -58,13 +59,14 @@ SellDialog::SellDialog(Network *network):
mScrollArea = new ScrollArea(mShopItemList);
mSlider = new Slider(1.0);
mQuantityLabel = new gcn::Label("0");
- mMoneyLabel = new gcn::Label("Money: 0 GP / Total: 0 GP");
+ mMoneyLabel = new gcn::Label(
+ strprintf(_("Price: %d GP / Total: %d GP"), 0, 0));
mIncreaseButton = new Button("+", "+", this);
mDecreaseButton = new Button("-", "-", this);
- mSellButton = new Button("Sell", "sell", this);
- mQuitButton = new Button("Quit", "quit", this);
- mItemDescLabel = new gcn::Label("Description:");
- mItemEffectLabel = new gcn::Label("Effect:");
+ mSellButton = new Button(_("Sell"), "sell", this);
+ mQuitButton = new Button(_("Quit"), "quit", this);
+ mItemDescLabel = new gcn::Label(strprintf(_("Description: %s"), ""));
+ mItemEffectLabel = new gcn::Label(strprintf(_("Effect: %s"), ""));
mIncreaseButton->setSize(20, 20);
mDecreaseButton->setSize(20, 20);
@@ -261,14 +263,19 @@ void SellDialog::setMoney(int amount)
mShopItemList->setPlayersMoney(amount);
}
-void
-SellDialog::updateButtonsAndLabels()
+void SellDialog::updateButtonsAndLabels()
{
int selectedItem = mShopItemList->getSelected();
int income = 0;
if (selectedItem > -1)
{
+ const ItemInfo &info = mShopItems->at(selectedItem)->getInfo();
+ mItemDescLabel->setCaption
+ (strprintf(_("Description: %s"), info.getDescription().c_str()));
+ mItemEffectLabel->setCaption
+ (strprintf(_("Effect: %s"), info.getEffect().c_str()));
+
mMaxItems = mShopItems->at(selectedItem)->getQuantity();
if (mAmountItems > mMaxItems)
{
@@ -276,17 +283,13 @@ SellDialog::updateButtonsAndLabels()
}
income = mAmountItems * mShopItems->at(selectedItem)->getPrice();
-
- const ItemInfo &info = mShopItems->at(selectedItem)->getInfo();
- mItemDescLabel->setCaption("Description: " + info.getDescription());
- mItemEffectLabel->setCaption("Effect: " + info.getEffect());
}
else
{
+ mItemDescLabel->setCaption(strprintf(_("Description: %s"), ""));
+ mItemEffectLabel->setCaption(strprintf(_("Effect: %s"), ""));
mMaxItems = 0;
mAmountItems = 0;
- mItemDescLabel->setCaption("Description:");
- mItemEffectLabel->setCaption("Effect:");
}
// Update Buttons and slider
@@ -296,8 +299,8 @@ SellDialog::updateButtonsAndLabels()
mSlider->setEnabled(mMaxItems > 1);
// Update the quantity and money labels
- mQuantityLabel->setCaption(
- toString(mAmountItems) + " / " + toString(mMaxItems));
- mMoneyLabel->setCaption("Money: " + toString(income) + " GP / Total: "
- + toString(mPlayerMoney + income) + " GP");
+ mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems));
+ mMoneyLabel->setCaption
+ (strprintf(_("Price: %d GP / Total: %d GP"),
+ income, mPlayerMoney + income));
}
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 2da9d1b5..067d8d64 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -32,6 +32,8 @@
#include "tabbedcontainer.h"
#include "../utils/dtor.h"
+#include "../utils/gettext.h"
+
#include <iostream>
extern Window *statusWindow;
@@ -52,12 +54,12 @@ Setup::Setup():
int height = 265;
setContentSize(width, height);
- const char *buttonNames[] = {
- "Apply", "Cancel", "Reset Windows", 0
+ static const char *buttonNames[] = {
+ N_("Apply"), N_("Cancel"), N_("Reset Windows"), 0
};
int x = width;
for (const char **curBtn = buttonNames; *curBtn; ++curBtn) {
- Button *btn = new Button(*curBtn, *curBtn, this);
+ Button *btn = new Button(gettext(*curBtn), *curBtn, this);
x -= btn->getWidth() + 5;
btn->setPosition(x, height - btn->getHeight() - 5);
add(btn);
@@ -74,23 +76,23 @@ Setup::Setup():
SetupTab *tab;
tab = new Setup_Video();
- panel->addTab(tab, "Video");
+ panel->addTab(tab, _("Video"));
mTabs.push_back(tab);
tab = new Setup_Audio();
- panel->addTab(tab, "Audio");
+ panel->addTab(tab, _("Audio"));
mTabs.push_back(tab);
tab = new Setup_Joystick();
- panel->addTab(tab, "Joystick");
+ panel->addTab(tab, _("Joystick"));
mTabs.push_back(tab);
tab = new Setup_Keyboard();
- panel->addTab(tab, "Keyboard");
+ panel->addTab(tab, _("Keyboard"));
mTabs.push_back(tab);
tab = new Setup_Players();
- panel->addTab(tab, "Players");
+ panel->addTab(tab, _("Players"));
mTabs.push_back(tab);
add(panel);
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index a027e133..c595edc9 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -31,18 +31,20 @@
#include "../log.h"
#include "../sound.h"
+#include "../utils/gettext.h"
+
Setup_Audio::Setup_Audio():
mMusicVolume((int)config.getValue("musicVolume", 60)),
mSfxVolume((int)config.getValue("sfxVolume", 100)),
mSoundEnabled(config.getValue("sound", 0)),
- mSoundCheckBox(new CheckBox("Sound", mSoundEnabled)),
+ mSoundCheckBox(new CheckBox(_("Sound"), mSoundEnabled)),
mSfxSlider(new Slider(0, 128)),
mMusicSlider(new Slider(0, 128))
{
setOpaque(false);
- gcn::Label *sfxLabel = new gcn::Label("Sfx volume");
- gcn::Label *musicLabel = new gcn::Label("Music volume");
+ gcn::Label *sfxLabel = new gcn::Label(_("Sfx volume"));
+ gcn::Label *musicLabel = new gcn::Label(_("Music volume"));
mSfxSlider->setActionEventId("sfx");
mMusicSlider->setActionEventId("music");
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index c59068f7..a718f87e 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -28,12 +28,14 @@
#include "../configuration.h"
#include "../joystick.h"
+#include "../utils/gettext.h"
+
extern Joystick *joystick;
Setup_Joystick::Setup_Joystick():
- mCalibrateLabel(new gcn::Label("Press the button to start calibration")),
- mCalibrateButton(new Button("Calibrate", "calibrate", this)),
- mJoystickEnabled(new CheckBox("Enable joystick"))
+ mCalibrateLabel(new gcn::Label(_("Press the button to start calibration"))),
+ mCalibrateButton(new Button(_("Calibrate"), "calibrate", this)),
+ mJoystickEnabled(new CheckBox(_("Enable joystick")))
{
setOpaque(false);
mJoystickEnabled->setPosition(10, 10);
@@ -63,13 +65,13 @@ void Setup_Joystick::action(const gcn::ActionEvent &event)
else
{
if (joystick->isCalibrating()) {
- mCalibrateButton->setCaption("Calibrate");
- mCalibrateLabel->setCaption(
- "Press the button to start calibration");
+ mCalibrateButton->setCaption(_("Calibrate"));
+ mCalibrateLabel->setCaption
+ (_("Press the button to start calibration"));
joystick->finishCalibration();
} else {
- mCalibrateButton->setCaption("Stop");
- mCalibrateLabel->setCaption("Rotate the stick");
+ mCalibrateButton->setCaption(_("Stop"));
+ mCalibrateLabel->setCaption(_("Rotate the stick"));
joystick->startCalibration();
}
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 54169b63..0debe163 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -43,6 +43,7 @@
#include "../main.h"
#include "../particle.h"
+#include "../utils/gettext.h"
#include "../utils/tostring.h"
extern Graphics *graphics;
@@ -108,11 +109,11 @@ Setup_Video::Setup_Video():
mFps((int) config.getValue("fpslimit", 0)),
mModeListModel(new ModeListModel),
mModeList(new ListBox(mModeListModel)),
- mFsCheckBox(new CheckBox("Full screen", mFullScreenEnabled)),
- mOpenGLCheckBox(new CheckBox("OpenGL", mOpenGLEnabled)),
- mCustomCursorCheckBox(new CheckBox("Custom cursor", mCustomCursorEnabled)),
+ mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)),
+ mOpenGLCheckBox(new CheckBox(_("OpenGL"), mOpenGLEnabled)),
+ mCustomCursorCheckBox(new CheckBox(_("Custom cursor"), mCustomCursorEnabled)),
mAlphaSlider(new Slider(0.2, 1.0)),
- mFpsCheckBox(new CheckBox("FPS Limit: ")),
+ mFpsCheckBox(new CheckBox(_("FPS Limit:"))),
mFpsSlider(new Slider(10, 200)),
mFpsField(new TextField),
mOriginalScrollLaziness((int) config.getValue("ScrollLaziness", 16)),
@@ -131,7 +132,7 @@ Setup_Video::Setup_Video():
setOpaque(false);
ScrollArea *scrollArea = new ScrollArea(mModeList);
- gcn::Label *alphaLabel = new gcn::Label("Gui opacity");
+ gcn::Label *alphaLabel = new gcn::Label(_("Gui opacity"));
mModeList->setEnabled(false);
#ifndef USE_OPENGL
@@ -188,7 +189,7 @@ Setup_Video::Setup_Video():
mParticleDetailField->addKeyListener(this);
mScrollRadiusSlider->setDimension(gcn::Rectangle(10, 120, 75, 10));
- gcn::Label *scrollRadiusLabel = new gcn::Label("Scroll radius");
+ gcn::Label *scrollRadiusLabel = new gcn::Label(_("Scroll radius"));
scrollRadiusLabel->setPosition(90, 120);
mScrollRadiusField->setPosition(mFpsField->getX(), 120);
mScrollRadiusField->setWidth(30);
@@ -196,7 +197,7 @@ Setup_Video::Setup_Video():
mScrollRadiusSlider->setValue(mOriginalScrollRadius);
mScrollLazinessSlider->setDimension(gcn::Rectangle(10, 140, 75, 10));
- gcn::Label *scrollLazinessLabel = new gcn::Label("Scroll laziness");
+ gcn::Label *scrollLazinessLabel = new gcn::Label(_("Scroll laziness"));
scrollLazinessLabel->setPosition(90, 140);
mScrollLazinessField->setPosition(mFpsField->getX(), 140);
mScrollLazinessField->setWidth(30);
@@ -204,42 +205,42 @@ Setup_Video::Setup_Video():
mScrollLazinessSlider->setValue(mOriginalScrollLaziness);
mOverlayDetailSlider->setDimension(gcn::Rectangle(10, 160, 75, 10));
- gcn::Label *overlayDetailLabel = new gcn::Label("Ambient FX");
+ gcn::Label *overlayDetailLabel = new gcn::Label(_("Ambient FX"));
overlayDetailLabel->setPosition(90, 160);
mOverlayDetailField->setPosition(180, 160);
mOverlayDetailField->setWidth(30);
switch (mOverlayDetail)
{
case 0:
- mOverlayDetailField->setCaption("off");
+ mOverlayDetailField->setCaption(_("off"));
break;
case 1:
- mOverlayDetailField->setCaption("low");
+ mOverlayDetailField->setCaption(_("low"));
break;
case 2:
- mOverlayDetailField->setCaption("high");
+ mOverlayDetailField->setCaption(_("high"));
break;
}
mOverlayDetailSlider->setValue(mOverlayDetail);
mParticleDetailSlider->setDimension(gcn::Rectangle(10, 180, 75, 10));
- gcn::Label *particleDetailLabel = new gcn::Label("Particle Detail");
+ gcn::Label *particleDetailLabel = new gcn::Label(_("Particle Detail"));
particleDetailLabel->setPosition(90, 180);
mParticleDetailField->setPosition(180, 180);
mParticleDetailField->setWidth(60);
switch (mParticleDetail)
{
case 0:
- mParticleDetailField->setCaption("low");
+ mParticleDetailField->setCaption(_("low"));
break;
case 1:
- mParticleDetailField->setCaption("medium");
+ mParticleDetailField->setCaption(_("medium"));
break;
case 2:
- mParticleDetailField->setCaption("high");
+ mParticleDetailField->setCaption(_("high"));
break;
case 3:
- mParticleDetailField->setCaption("max");
+ mParticleDetailField->setCaption(_("max"));
break;
}
mParticleDetailSlider->setValue(mParticleDetail);
@@ -305,8 +306,8 @@ void Setup_Video::apply()
}
#ifdef WIN32
} else {
- new OkDialog("Switching to full screen",
- "Restart needed for changes to take effect.");
+ new OkDialog(_("Switching to full screen"),
+ _("Restart needed for changes to take effect."));
}
#endif
config.setValue("screen", fullscreen ? 1 : 0);
@@ -318,8 +319,8 @@ void Setup_Video::apply()
config.setValue("opengl", mOpenGLCheckBox->isSelected() ? 1 : 0);
// OpenGL can currently only be changed by restarting, notify user.
- new OkDialog("Changing OpenGL",
- "Applying change to OpenGL requires restart.");
+ new OkDialog(_("Changing OpenGL"),
+ _("Applying change to OpenGL requires restart."));
}
// FPS change
@@ -408,13 +409,13 @@ void Setup_Video::action(const gcn::ActionEvent &event)
switch (val)
{
case 0:
- mOverlayDetailField->setCaption("off");
+ mOverlayDetailField->setCaption(_("off"));
break;
case 1:
- mOverlayDetailField->setCaption("low");
+ mOverlayDetailField->setCaption(_("low"));
break;
case 2:
- mOverlayDetailField->setCaption("high");
+ mOverlayDetailField->setCaption(_("high"));
break;
}
config.setValue("OverlayDetail", val);
@@ -425,16 +426,16 @@ void Setup_Video::action(const gcn::ActionEvent &event)
switch (val)
{
case 0:
- mParticleDetailField->setCaption("low");
+ mParticleDetailField->setCaption(_("low"));
break;
case 1:
- mParticleDetailField->setCaption("medium");
+ mParticleDetailField->setCaption(_("medium"));
break;
case 2:
- mParticleDetailField->setCaption("high");
+ mParticleDetailField->setCaption(_("high"));
break;
case 3:
- mParticleDetailField->setCaption("max");
+ mParticleDetailField->setCaption(_("max"));
break;
}
config.setValue("particleEmitterSkip", 3 - val);
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 9347cc02..9b88b6fb 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -41,6 +41,8 @@
#include "../resources/iteminfo.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
#include "../utils/tostring.h"
TradeWindow::TradeWindow(Network *network):
@@ -56,10 +58,10 @@ TradeWindow::TradeWindow(Network *network):
setMinWidth(342);
setMinHeight(209);
- mAddButton = new Button("Add", "add", this);
- mOkButton = new Button("Ok", "ok", this);
- mCancelButton = new Button("Cancel", "cancel", this);
- mTradeButton = new Button("Trade", "trade", this);
+ mAddButton = new Button(_("Add"), "add", this);
+ mOkButton = new Button(_("Ok"), "ok", this);
+ mCancelButton = new Button(_("Cancel"), "cancel", this);
+ mTradeButton = new Button(_("Trade"), "trade", this);
mMyItemContainer = new ItemContainer(mMyInventory.get());
mMyItemContainer->addSelectionListener(this);
@@ -75,8 +77,8 @@ TradeWindow::TradeWindow(Network *network):
mPartnerScroll = new ScrollArea(mPartnerItemContainer);
mPartnerScroll->setPosition(8, 64);
- mMoneyLabel = new gcn::Label("You get: 0 GP");
- mMoneyLabel2 = new gcn::Label("You give:");
+ mMoneyLabel = new gcn::Label(strprintf(_("You get %d GP."), 0));
+ mMoneyLabel2 = new gcn::Label(_("You give:"));
mMoneyField = new TextField;
mMoneyField->setWidth(50);
@@ -87,8 +89,9 @@ TradeWindow::TradeWindow(Network *network):
mTradeButton->setEnabled(false);
- mItemNameLabel = new gcn::Label("Name:");
- mItemDescriptionLabel = new gcn::Label("Description:");
+ mItemNameLabel = new gcn::Label(strprintf(_("Name: %s"), ""));
+ mItemDescriptionLabel = new gcn::Label(
+ strprintf(_("Description: %s"), ""));
add(mMyScroll);
add(mPartnerScroll);
@@ -150,7 +153,7 @@ void TradeWindow::widgetResized(const gcn::Event &event)
void TradeWindow::addMoney(int amount)
{
- mMoneyLabel->setCaption("You get: " + toString(amount) + " GP");
+ mMoneyLabel->setCaption(strprintf(_("You get %d GP."), amount));
mMoneyLabel->adjustSize();
}
@@ -198,7 +201,7 @@ void TradeWindow::reset()
mOkButton->setEnabled(true);
mOkOther = false;
mOkMe = false;
- mMoneyLabel->setCaption("You get: 0 GP");
+ mMoneyLabel->setCaption(strprintf(_("You get %d GP."), 0));
mMoneyField->setEnabled(true);
mMoneyField->setText("");
}
@@ -257,21 +260,11 @@ void TradeWindow::valueChanged(const gcn::SelectionEvent &event)
}
// Update name and description
- if (!item)
- {
- mItemNameLabel->setCaption("Name:");
- mItemDescriptionLabel->setCaption("Description:");
- }
- else
- {
- std::string SomeText;
- SomeText = "Name: " + item->getInfo().getName();
- mItemNameLabel->setCaption(SomeText);
- mItemNameLabel->adjustSize();
- SomeText = "Description: " + item->getInfo().getDescription();
- mItemDescriptionLabel->setCaption(SomeText);
- mItemDescriptionLabel->adjustSize();
- }
+ ItemInfo const *info = item ? &item->getInfo() : NULL;
+ mItemNameLabel->setCaption(strprintf(_("Name: %s"),
+ info ? info->getName().c_str() : ""));
+ mItemDescriptionLabel->setCaption(strprintf(_("Description: %s"),
+ info ? info->getDescription().c_str() : ""));
}
void TradeWindow::action(const gcn::ActionEvent &event)