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;
+}
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);
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);
e->setPasswordBox(true);
}
- setlocale(LC_CTYPE, "");
+ changeCtype("");
// Address + port
{
core::rect<s32> rect(0, 0, 110, 20);
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);
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);
Environment->addButton(rect, this, GUI_ID_DELETE_MAP_BUTTON,
chartowchar_t(gettext("Delete map")));
}
- setlocale(LC_CTYPE, "en_US");
+ changeCtype("C");
}
void GUIMainMenu::drawMenu()
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);
chartowchar_t(gettext("Proceed")));
Environment->setFocus(e);
}
- setlocale(LC_CTYPE, "en_US");
+ changeCtype("en_US.UTF-8");
}
void GUIMessageMenu::drawMenu()
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);
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);
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);
}
ypos += 50;
- setlocale(LC_CTYPE, "");
+ changeCtype("");
{
core::rect<s32> rect(0, 0, 140, 30);
rect = rect + v2s32(size.X/2-140/2, ypos);
rect, false, true, this, ID_message);
e->setVisible(false);
}
- setlocale(LC_CTYPE, "en_US");
+ changeCtype("C");
}
const s32 btn_gap = 20;\r
const s32 btn_num = 4;\r
s32 btn_y = size.Y/2-((btn_num*btn_height+(btn_num-1)*btn_gap))/2;\r
- setlocale(LC_CTYPE, "");\r
+ changeCtype("");\r
{\r
core::rect<s32> rect(0, 0, 140, btn_height);\r
rect = rect + v2s32(size.X/2-140/2, btn_y);\r
\r
Environment->addStaticText(narrow_to_wide(os.str()).c_str(), rect, false, true, this, 259);\r
}\r
- setlocale(LC_CTYPE, "en_US");\r
+ changeCtype("C");\r
}\r
\r
void GUIPauseMenu::drawMenu()\r
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()