diff options
author | Constantin Wenger <constantin.wenger@googlemail.com> | 2011-07-30 10:14:58 +0200 |
---|---|---|
committer | Constantin Wenger <constantin.wenger@googlemail.com> | 2011-07-30 22:08:16 +0200 |
commit | 9baae3a701f7bdf50972d8381904d11eee77aa4e (patch) | |
tree | 2e76ca208ed28df66c6b22001dc1590dc6cf7736 /src | |
parent | 92f504f98d4af7a31df7b1bfa80fce114638f4cf (diff) | |
download | minetest-9baae3a701f7bdf50972d8381904d11eee77aa4e.tar.gz minetest-9baae3a701f7bdf50972d8381904d11eee77aa4e.tar.bz2 minetest-9baae3a701f7bdf50972d8381904d11eee77aa4e.zip |
set locales to C because en_US not installed on some systems, only UTF-8 version and en_US.UTF-8 does not work.
Diffstat (limited to 'src')
-rw-r--r-- | src/gettext.h | 10 | ||||
-rw-r--r-- | src/guiMainMenu.cpp | 12 | ||||
-rw-r--r-- | src/guiMessageMenu.cpp | 4 | ||||
-rw-r--r-- | src/guiPasswordChange.cpp | 16 | ||||
-rw-r--r-- | src/guiPauseMenu.cpp | 4 | ||||
-rw-r--r-- | src/guiTextInputMenu.cpp | 4 |
6 files changed, 30 insertions, 20 deletions
diff --git a/src/gettext.h b/src/gettext.h index 493f9b21b..790375165 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -25,3 +25,13 @@ inline wchar_t* chartowchar_t(const char *str) mbstowcs(nstr, str, l); return nstr; } + +inline void changeCtype(const char *l) +{ + char *ret = NULL; + ret = setlocale(LC_CTYPE, l); + if(ret == NULL) + std::cout<<"locale could not be set"<<std::endl; + else + std::cout<<"locale has been set to:"<<ret<<std::endl; +} diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index 0365b618a..63bc72d24 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -164,7 +164,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) v2s32 topleft_client(40, 0); v2s32 size_client = size - v2s32(40, 0); - setlocale(LC_CTYPE, ""); + changeCtype(""); { core::rect<s32> rect(0, 0, 20, 125); rect += topleft_client + v2s32(-15, 60); @@ -181,7 +181,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) Environment->addStaticText(chartowchar_t(gettext("Name/Password")), rect, false, true, this, -1); } - setlocale(LC_CTYPE, "en_US"); + changeCtype("C"); { core::rect<s32> rect(0, 0, 230, 30); rect += topleft_client + v2s32(160, 50); @@ -198,7 +198,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) e->setPasswordBox(true); } - setlocale(LC_CTYPE, ""); + changeCtype(""); // Address + port { core::rect<s32> rect(0, 0, 110, 20); @@ -206,7 +206,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) Environment->addStaticText(chartowchar_t(gettext("Address/Port")), rect, false, true, this, -1); } - setlocale(LC_CTYPE, "en_US"); + changeCtype("C"); { core::rect<s32> rect(0, 0, 230, 30); rect += topleft_client + v2s32(160, 100); @@ -221,7 +221,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) rect += topleft_client + v2s32(size_client.X-60-100, 100); Environment->addEditBox(text_port.c_str(), rect, true, this, GUI_ID_PORT_INPUT); } - setlocale(LC_CTYPE, ""); + changeCtype(""); { core::rect<s32> rect(0, 0, 400, 20); rect += topleft_client + v2s32(160, 100+35); @@ -294,7 +294,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) Environment->addButton(rect, this, GUI_ID_DELETE_MAP_BUTTON, chartowchar_t(gettext("Delete map"))); } - setlocale(LC_CTYPE, "en_US"); + changeCtype("C"); } void GUIMainMenu::drawMenu() diff --git a/src/guiMessageMenu.cpp b/src/guiMessageMenu.cpp index b03f87b31..27ff3dafa 100644 --- a/src/guiMessageMenu.cpp +++ b/src/guiMessageMenu.cpp @@ -85,7 +85,7 @@ void GUIMessageMenu::regenerateGui(v2u32 screensize) Environment->addStaticText(m_message_text.c_str(), rect, false, true, this, 256); } - setlocale(LC_CTYPE, ""); + changeCtype(""); { core::rect<s32> rect(0, 0, 140, 30); rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25); @@ -94,7 +94,7 @@ void GUIMessageMenu::regenerateGui(v2u32 screensize) chartowchar_t(gettext("Proceed"))); Environment->setFocus(e); } - setlocale(LC_CTYPE, "en_US"); + changeCtype("en_US.UTF-8"); } void GUIMessageMenu::drawMenu() diff --git a/src/guiPasswordChange.cpp b/src/guiPasswordChange.cpp index 89a6ce682..2a7fb009a 100644 --- a/src/guiPasswordChange.cpp +++ b/src/guiPasswordChange.cpp @@ -96,14 +96,14 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) Add stuff */ s32 ypos = 50; - setlocale(LC_CTYPE, ""); + changeCtype(""); { core::rect<s32> rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, ypos+6); Environment->addStaticText(chartowchar_t(gettext("Old Password")), rect, false, true, this, -1); } - setlocale(LC_CTYPE, "en_US"); + changeCtype("C"); { core::rect<s32> rect(0, 0, 230, 30); rect += topleft_client + v2s32(160, ypos); @@ -113,14 +113,14 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) e->setPasswordBox(true); } ypos += 50; - setlocale(LC_CTYPE, ""); + changeCtype(""); { core::rect<s32> rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, ypos+6); Environment->addStaticText(chartowchar_t(gettext("New Password")), rect, false, true, this, -1); } - setlocale(LC_CTYPE, "en_US"); + changeCtype("C"); { core::rect<s32> rect(0, 0, 230, 30); rect += topleft_client + v2s32(160, ypos); @@ -129,14 +129,14 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) e->setPasswordBox(true); } ypos += 50; - setlocale(LC_CTYPE, ""); + changeCtype(""); { core::rect<s32> rect(0, 0, 110, 20); rect += topleft_client + v2s32(35, ypos+6); Environment->addStaticText(chartowchar_t(gettext("Confirm Password")), rect, false, true, this, -1); } - setlocale(LC_CTYPE, "en_US"); + changeCtype("C"); { core::rect<s32> rect(0, 0, 230, 30); rect += topleft_client + v2s32(160, ypos); @@ -146,7 +146,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) } ypos += 50; - setlocale(LC_CTYPE, ""); + changeCtype(""); { core::rect<s32> rect(0, 0, 140, 30); rect = rect + v2s32(size.X/2-140/2, ypos); @@ -163,7 +163,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize) rect, false, true, this, ID_message); e->setVisible(false); } - setlocale(LC_CTYPE, "en_US"); + changeCtype("C"); } diff --git a/src/guiPauseMenu.cpp b/src/guiPauseMenu.cpp index 3a5d245bc..6cf364e5f 100644 --- a/src/guiPauseMenu.cpp +++ b/src/guiPauseMenu.cpp @@ -103,7 +103,7 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize) const s32 btn_gap = 20;
const s32 btn_num = 4;
s32 btn_y = size.Y/2-((btn_num*btn_height+(btn_num-1)*btn_gap))/2;
- setlocale(LC_CTYPE, "");
+ changeCtype("");
{
core::rect<s32> rect(0, 0, 140, btn_height);
rect = rect + v2s32(size.X/2-140/2, btn_y);
@@ -181,7 +181,7 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize) Environment->addStaticText(narrow_to_wide(os.str()).c_str(), rect, false, true, this, 259);
}
- setlocale(LC_CTYPE, "en_US");
+ changeCtype("C");
}
void GUIPauseMenu::drawMenu()
diff --git a/src/guiTextInputMenu.cpp b/src/guiTextInputMenu.cpp index 8c32490be..a59602554 100644 --- a/src/guiTextInputMenu.cpp +++ b/src/guiTextInputMenu.cpp @@ -104,14 +104,14 @@ void GUITextInputMenu::regenerateGui(v2u32 screensize) Environment->addEditBox(text.c_str(), rect, true, this, 256); Environment->setFocus(e); } - setlocale(LC_CTYPE, ""); + changeCtype(""); { core::rect<s32> rect(0, 0, 140, 30); rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25); Environment->addButton(rect, this, 257, chartowchar_t(gettext("Proceed"))); } - setlocale(LC_CTYPE, "en_US"); + changeCtype("C"); } void GUITextInputMenu::drawMenu() |