summaryrefslogtreecommitdiff
path: root/src/gui/setup_players.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-01-08 22:03:33 +0100
committerIra Rice <irarice@gmail.com>2009-01-08 16:27:30 -0700
commit193ccbdba8031a351ea622f8842b6d9a0b6cfd43 (patch)
tree5e62faa24be231e60a3aa2643fa233f356ac23c7 /src/gui/setup_players.cpp
parent3f8387402ee7b528026450232cb457c8ae1cf4e2 (diff)
downloadmana-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/gui/setup_players.cpp')
-rw-r--r--src/gui/setup_players.cpp62
1 files changed, 40 insertions, 22 deletions
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);
}