From 193ccbdba8031a351ea622f8842b6d9a0b6cfd43 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 8 Jan 2009 22:03:33 +0100 Subject: Made remaining dialogs translatable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/gui/skill.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'src/gui/skill.cpp') diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 321a6c52..5e5782d9 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -32,9 +32,11 @@ #include "../log.h" #include "../utils/dtor.h" +#include "../utils/gettext.h" +#include "../utils/strprintf.h" #include "../utils/xml.h" -#define SKILLS_FILE "skills.xml" +static const char *SKILLS_FILE = "skills.xml"; struct SkillInfo { std::string name; @@ -77,7 +79,7 @@ public: virtual void update(void) { - static const SkillInfo fakeSkillInfo = { "???", false }; + static const SkillInfo fakeSkillInfo = { _("???"), false }; mEntriesNr = mDialog->getSkills().size(); resize(); @@ -94,13 +96,13 @@ public: info = &fakeSkillInfo; sprintf(tmp, "%c%s", info->modifiable? ' ' : '*', info->name.c_str()); - gcn::Label *name_label = new gcn::Label(std::string(tmp)); + gcn::Label *name_label = new gcn::Label(tmp); sprintf(tmp, "Lv:%i", skill->lv); - gcn::Label *lv_label = new gcn::Label(std::string(tmp)); + gcn::Label *lv_label = new gcn::Label(tmp); sprintf(tmp, "Sp:%i", skill->sp); - gcn::Label *sp_label = new gcn::Label(std::string(tmp)); + gcn::Label *sp_label = new gcn::Label(tmp); set(i, 0, name_label); set(i, 1, lv_label); @@ -116,22 +118,22 @@ private: SkillDialog::SkillDialog(): - Window("Skills") + Window(_("Skills")) { initSkillinfo(); mTableModel = new SkillGuiTableModel(this); mTable.setModel(mTableModel); mTable.setLinewiseSelection(true); - setWindowName("Skills"); + setWindowName(_("Skills")); setCloseButton(true); setDefaultSize(windowContainer->getWidth() - 260, 25, 255, 260); // mSkillListBox = new ListBox(this); - skillScrollArea = new ScrollArea(&mTable); - mPointsLabel = new gcn::Label("Skill Points:"); - mIncButton = new Button("Up", "inc", this); - mUseButton = new Button("Use", "use", this); + ScrollArea *skillScrollArea = new ScrollArea(&mTable); + mPointsLabel = new gcn::Label(strprintf(_("Skill points: %d"), 0)); + mIncButton = new Button(_("Up"), _("inc"), this); + mUseButton = new Button(_("Use"), _("use"), this); mUseButton->setEnabled(false); // mSkillListBox->setActionEventId("skill"); @@ -185,11 +187,8 @@ void SkillDialog::action(const gcn::ActionEvent &event) void SkillDialog::update() { - if (mPointsLabel != NULL) { - char tmp[128]; - sprintf(tmp, "Skill points: %i", player_node->mSkillPoint); - mPointsLabel->setCaption(tmp); - } + mPointsLabel->setCaption(strprintf(_("Skill points: %d"), + player_node->mSkillPoint)); int selectedSkill = mTable.getSelectedRow(); @@ -260,8 +259,7 @@ initSkillinfo(void) if (!root || !xmlStrEqual(root->name, BAD_CAST "skills")) { - logger->log("Error loading skills file: " - SKILLS_FILE); + logger->log(_("Error loading skills file: %s"), SKILLS_FILE); skill_db.resize(2, emptySkillInfo); skill_db[1].name = "Basic"; skill_db[1].modifiable = true; -- cgit v1.2.3-70-g09d2