From 8e2467c393e8dcb3f0d48b9e3258bf0526e6256f Mon Sep 17 00:00:00 2001 From: BlockMen Date: Wed, 17 Jul 2013 21:18:24 +0200 Subject: Add gettext translation for image_button --- src/guiFormSpecMenu.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index a67768deb..e950c088b 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -1151,9 +1151,16 @@ void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,std: label = unescape_string(label); + wchar_t* wlabel = 0; + + if (m_use_gettext) + wlabel = wgettext(label.c_str()); + else + wlabel = (wchar_t*) narrow_to_wide(label.c_str()).c_str(); + FieldSpec spec = FieldSpec( narrow_to_wide(name.c_str()), - narrow_to_wide(label.c_str()), + wlabel, narrow_to_wide(image_name.c_str()), 258+m_fields.size() ); @@ -1182,6 +1189,8 @@ void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,std: e->setDrawBorder(drawborder); m_fields.push_back(spec); + if (m_use_gettext) + delete[] wlabel; return; } -- cgit v1.2.3