summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-25 12:30:15 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-25 12:30:15 +0300
commit8ade9e707f81e11570ec8bac9d4b4157f829a2c6 (patch)
tree99fdc33862eb8bd909314d3f15b533778c332f1d /src
parent3d7be7b307d5ebf4171623a6628d66b82ed4e792 (diff)
downloadplus-8ade9e707f81e11570ec8bac9d4b4157f829a2c6.tar.gz
plus-8ade9e707f81e11570ec8bac9d4b4157f829a2c6.tar.bz2
plus-8ade9e707f81e11570ec8bac9d4b4157f829a2c6.tar.xz
plus-8ade9e707f81e11570ec8bac9d4b4157f829a2c6.zip
Fix actions translation.
Diffstat (limited to 'src')
-rw-r--r--src/gui/setup_input.cpp37
-rw-r--r--src/gui/setup_input.h5
-rw-r--r--src/gui/setupactiondata.h2
3 files changed, 42 insertions, 2 deletions
diff --git a/src/gui/setup_input.cpp b/src/gui/setup_input.cpp
index 48ec90124..b1054fac3 100644
--- a/src/gui/setup_input.cpp
+++ b/src/gui/setup_input.cpp
@@ -145,6 +145,8 @@ Setup_Input::Setup_Input():
k ++;
}
+ fixTranslations();
+
// Do the layout
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
@@ -205,7 +207,6 @@ void Setup_Input::cancel()
void Setup_Input::action(const gcn::ActionEvent &event)
{
- logger->log("event: %s", event.getId().c_str());
const std::string id = event.getId();
if (event.getSource() == mKeyList)
@@ -360,3 +361,37 @@ void Setup_Input::keyUnresolved()
inputManager.setNewKeyIndex(Input::KEY_NO_VALUE);
}
}
+
+void Setup_Input::fixTranslation(SetupActionData *actionDatas, int actionStart,
+ int actionEnd, std::string text)
+{
+ int k = 0;
+
+ while (!actionDatas[k].name.empty())
+ {
+ SetupActionData &data = actionDatas[k];
+
+ const int actionId = data.actionId;
+ if (actionId >= actionStart && actionId <= actionEnd)
+ {
+ data.name = strprintf(gettext(text.c_str()),
+ actionId - actionStart + 1);
+ }
+ k ++;
+ }
+}
+
+void Setup_Input::fixTranslations()
+{
+ fixTranslation(setupActionData1, Input::KEY_SHORTCUT_1,
+ Input::KEY_SHORTCUT_20, "Item Shortcut %d");
+
+ fixTranslation(setupActionData3, Input::KEY_EMOTE_1,
+ Input::KEY_EMOTE_48, "Emote Shortcut %d");
+
+ fixTranslation(setupActionData4, Input::KEY_OUTFIT_1,
+ Input::KEY_OUTFIT_48, "Outfit Shortcut %d");
+
+ fixTranslation(setupActionData7, Input::KEY_MOVE_TO_POINT_1,
+ Input::KEY_MOVE_TO_POINT_48, "Move to point Shortcut %d");
+}
diff --git a/src/gui/setup_input.h b/src/gui/setup_input.h
index 645f6f6a5..89b102881 100644
--- a/src/gui/setup_input.h
+++ b/src/gui/setup_input.h
@@ -80,6 +80,11 @@ class Setup_Input : public SetupTab
std::string keyToString(int index);
private:
+ void fixTranslations();
+
+ void fixTranslation(SetupActionData *actionDatas, int actionStart,
+ int actionEnd, std::string text);
+
class KeyListModel *mKeyListModel;
gcn::ListBox *mKeyList;
diff --git a/src/gui/setupactiondata.h b/src/gui/setupactiondata.h
index 99e846d9c..3be3fb39f 100644
--- a/src/gui/setupactiondata.h
+++ b/src/gui/setupactiondata.h
@@ -37,7 +37,7 @@ int selectedData = 0;
struct SetupActionData
{
- const std::string name;
+ std::string name;
const int actionId;
std::string text;
};