summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-06 10:20:36 -0700
committerIra Rice <irarice@gmail.com>2009-01-06 10:20:36 -0700
commit2a065b5ef24441b0df2c06fbcae6dcf6fd5f5251 (patch)
treed4bee5fa8cb866618995e666ce1fdf37ca174f3b /src/gui/inventorywindow.cpp
parenta570ee66c7cf6ddff7b0c124ad4b633b4651bdb3 (diff)
downloadmana-2a065b5ef24441b0df2c06fbcae6dcf6fd5f5251.tar.gz
mana-2a065b5ef24441b0df2c06fbcae6dcf6fd5f5251.tar.bz2
mana-2a065b5ef24441b0df2c06fbcae6dcf6fd5f5251.tar.xz
mana-2a065b5ef24441b0df2c06fbcae6dcf6fd5f5251.zip
Added support for internationalization
Merged from the mainline client. Originally implemented by Guillaume Melquiond, starting with commit 1828eee6a6d91fd385ad1e69d93044516493aa91. Conflicts: INSTALL configure.ac src/Makefile.am src/gui/buy.cpp src/gui/confirm_dialog.cpp src/gui/inventorywindow.cpp src/gui/login.cpp src/gui/menuwindow.cpp src/gui/minimap.cpp src/gui/ok_dialog.cpp src/gui/popupmenu.cpp src/gui/register.cpp src/gui/sell.cpp src/gui/setup.cpp src/gui/setup_video.cpp Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r--src/gui/inventorywindow.cpp43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 621a85d3..8c5edec4 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -37,10 +37,12 @@
#include "../resources/iteminfo.h"
+#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
#include "../utils/tostring.h"
InventoryWindow::InventoryWindow():
- Window("Inventory")
+ Window(_("Inventory"))
{
setWindowName("Inventory");
setResizable(true);
@@ -49,8 +51,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(), 2);
mItems->addSelectionListener(this);
@@ -61,14 +63,14 @@ InventoryWindow::InventoryWindow():
mTotalWeight = toString(player_node->mTotalWeight);
mMaxWeight = toString(player_node->mMaxWeight);
- mItemName = "Name:";
+ mItemName = _("Name:");
mItemNameLabel = new TextBox();
- mItemDescription = "Description:";
+ mItemDescription = _("Description:");
mItemDescriptionLabel = new TextBox();
- mItemEffect = "Effect:";
+ mItemEffect = _("Effect:");
mItemEffectLabel = new TextBox();
- mWeight = "Weight: " + mTotalWeight + " g / " +
- mMaxWeight + " g Slots: " +
+ mWeight = _("Weight: ") + mTotalWeight + " g / " +
+ mMaxWeight + _(" g Slots: ") +
toString(player_node->getInventory()->getNumberOfSlotsUsed()) +
"/" + toString(player_node->getInventory()->getInventorySize());
mWeightLabel = new TextBox();
@@ -105,8 +107,8 @@ void InventoryWindow::logic()
mMaxWeight = toString(player_node->mMaxWeight);
// Adjust widgets
- mWeight = "Weight: " + mTotalWeight + " g / " +
- mMaxWeight + " g Slots: " +
+ mWeight = _("Weight: ") + mTotalWeight + " g / " +
+ mMaxWeight + _(" g Slots: ") +
toString(player_node->getInventory()->getNumberOfSlotsUsed()) +
"/" + toString(player_node->getInventory()->getInventorySize());
@@ -153,21 +155,21 @@ void InventoryWindow::valueChanged(const gcn::SelectionEvent &event)
// Update name, effect and description
if (!item)
{
- mItemName = "Name:";
+ mItemName = _("Name:");
mItemNameLabel->setTextWrapped(mItemName);
- mItemEffect = "Effect:";
+ mItemEffect = _("Effect:");
mItemEffectLabel->setTextWrapped(mItemEffect);
- mItemDescription = "Description:";
+ mItemDescription = _("Description:");
mItemDescriptionLabel->setTextWrapped(mItemDescription);
}
else
{
const ItemInfo& itemInfo = item->getInfo();
- mItemName = "Name: " + itemInfo.getName();
+ mItemName = _("Name: ") + itemInfo.getName();
mItemNameLabel->setTextWrapped(mItemName);
- mItemEffect = "Effect: " + itemInfo.getEffect();
+ mItemEffect = _("Effect: ") + itemInfo.getEffect();
mItemEffectLabel->setTextWrapped(mItemEffect);
- mItemDescription = "Description: " + itemInfo.getDescription();
+ mItemDescription = _("Description: ") + itemInfo.getDescription();
mItemDescriptionLabel->setTextWrapped(mItemDescription);
}
@@ -182,7 +184,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.
@@ -249,14 +252,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);