aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/guiEngine.cpp1
-rw-r--r--src/guiFormSpecMenu.cpp51
-rw-r--r--src/guiFormSpecMenu.h5
-rw-r--r--src/script/lua_api/l_mainmenu.cpp11
-rw-r--r--src/script/lua_api/l_mainmenu.h2
5 files changed, 14 insertions, 56 deletions
diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp
index 37f570acf..f89ad8731 100644
--- a/src/guiEngine.cpp
+++ b/src/guiEngine.cpp
@@ -136,7 +136,6 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
m_menu->lockSize(true,v2u32(800,600));
m_menu->setFormSource(m_formspecgui);
m_menu->setTextDest(m_buttonhandler);
- m_menu->useGettext(true);
// Initialize scripting
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index 993252c3b..e420f7be4 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -44,10 +44,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/numeric.h"
#include "filesys.h"
#include "gettime.h"
-
#include "gettext.h"
-
#define MY_CHECKPOS(a,b) \
if (v_pos.size() != 2) { \
errorstream<< "Invalid pos for element " << a << "specified: \"" \
@@ -88,7 +86,6 @@ GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
m_listbox_doubleclick(false),
m_tooltip_element(NULL),
m_allowclose(true),
- m_use_gettext(false),
m_lock(false)
{
current_keys_pending.key_down = false;
@@ -379,9 +376,6 @@ void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element) {
std::wstring wlabel = narrow_to_wide(label.c_str());
- if (m_use_gettext)
- wlabel = wstrgettext(label);
-
FieldSpec spec = FieldSpec(
narrow_to_wide(name.c_str()),
L"",
@@ -499,9 +493,6 @@ void GUIFormSpecMenu::parseButton(parserData* data,std::string element,std::stri
std::wstring wlabel = narrow_to_wide(label.c_str());
- if (m_use_gettext)
- wlabel = wstrgettext(label);
-
FieldSpec spec = FieldSpec(
narrow_to_wide(name.c_str()),
wlabel,
@@ -609,7 +600,6 @@ void GUIFormSpecMenu::parseTextList(parserData* data,std::string element) {
std::wstring toadd =
narrow_to_wide(unescape_string(items[i]).c_str() + 7);
-
e->addItem(toadd.c_str());
irr::video::SColor toset;
@@ -733,13 +723,6 @@ void GUIFormSpecMenu::parsePwdField(parserData* data,std::string element) {
std::wstring wlabel = narrow_to_wide(label.c_str());
- if (m_use_gettext) {
- if (label.length() > 1)
- wlabel = wstrgettext(label);
- else
- wlabel = L"";
- }
-
FieldSpec spec = FieldSpec(
narrow_to_wide(name.c_str()),
wlabel,
@@ -812,13 +795,6 @@ void GUIFormSpecMenu::parseSimpleField(parserData* data,std::vector<std::string>
std::wstring wlabel = narrow_to_wide(label.c_str());
- if (m_use_gettext) {
- if (label.length() > 1)
- wlabel = wstrgettext(label);
- else
- wlabel = L"";
- }
-
FieldSpec spec = FieldSpec(
narrow_to_wide(name.c_str()),
wlabel,
@@ -902,13 +878,6 @@ void GUIFormSpecMenu::parseTextArea(parserData* data,std::vector<std::string>& p
std::wstring wlabel = narrow_to_wide(label.c_str());
- if (m_use_gettext) {
- if (label.length() > 1)
- wlabel = wstrgettext(label);
- else
- wlabel = L"";
- }
-
FieldSpec spec = FieldSpec(
narrow_to_wide(name.c_str()),
wlabel,
@@ -989,9 +958,6 @@ void GUIFormSpecMenu::parseLabel(parserData* data,std::string element) {
std::wstring wlabel = narrow_to_wide(text.c_str());
- if (m_use_gettext)
- wlabel = wstrgettext(text);
-
FieldSpec spec = FieldSpec(
L"",
wlabel,
@@ -1026,12 +992,6 @@ void GUIFormSpecMenu::parseVertLabel(parserData* data,std::string element) {
text = unescape_string(text);
std::string label = "";
- if (m_use_gettext) {
- const char* toset = gettext(text.c_str());
-
- text = std::string(toset);
- }
-
for (unsigned int i=0; i < text.length(); i++) {
label += text.c_str()[i];
label += "\n";
@@ -1098,9 +1058,6 @@ void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,std:
std::wstring wlabel = narrow_to_wide(label.c_str());
- if (m_use_gettext)
- wlabel = wstrgettext(label);
-
FieldSpec spec = FieldSpec(
narrow_to_wide(name.c_str()),
wlabel,
@@ -1194,15 +1151,9 @@ void GUIFormSpecMenu::parseTabHeader(parserData* data,std::string element) {
for (unsigned int i=0; i< buttons.size(); i++) {
wchar_t* wbutton = 0;
- if (m_use_gettext)
- wbutton = wgettext(buttons[i].c_str());
- else
- wbutton = (wchar_t*) narrow_to_wide(buttons[i].c_str()).c_str();
+ wbutton = (wchar_t*) narrow_to_wide(buttons[i].c_str()).c_str();
e->addTab(wbutton,-1);
-
- if (m_use_gettext)
- delete[] wbutton;
}
if ((tab_index >= 0) &&
diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h
index f8d7ff1fb..640c35c0a 100644
--- a/src/guiFormSpecMenu.h
+++ b/src/guiFormSpecMenu.h
@@ -206,10 +206,6 @@ public:
m_allowclose = value;
}
- void useGettext(bool value) {
- m_use_gettext = true;
- }
-
void lockSize(bool lock,v2u32 basescreensize=v2u32(0,0)) {
m_lock = lock;
m_lockscreensize = basescreensize;
@@ -282,7 +278,6 @@ protected:
gui::IGUIStaticText *m_tooltip_element;
bool m_allowclose;
- bool m_use_gettext;
bool m_lock;
v2u32 m_lockscreensize;
private:
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index b3ae1f3f1..65676eacd 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -981,6 +981,16 @@ int ModApiMainMenu::l_download_file(lua_State *L)
}
/******************************************************************************/
+int ModApiMainMenu::l_gettext(lua_State *L)
+{
+ const char* str = luaL_checkstring(L, 1);
+ str = gettext(str);
+ lua_pushstring(L, str);
+
+ return 1;
+}
+
+/******************************************************************************/
void ModApiMainMenu::Initialize(lua_State *L, int top)
{
API_FCT(update_formspec);
@@ -1013,4 +1023,5 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
API_FCT(get_modstore_list);
API_FCT(sound_play);
API_FCT(sound_stop);
+ API_FCT(gettext);
}
diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h
index 21dd82c68..d0f3d6f72 100644
--- a/src/script/lua_api/l_mainmenu.h
+++ b/src/script/lua_api/l_mainmenu.h
@@ -81,6 +81,8 @@ private:
static int l_sound_stop(lua_State *L);
+ static int l_gettext(lua_State *L);
+
//gui
static int l_show_keys_menu(lua_State *L);