a lot of translation fixes

This commit is contained in:
darkrose 2014-11-17 18:33:26 +10:00
parent acaf95471c
commit eaa90c0086
15 changed files with 4370 additions and 4225 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -55,6 +55,7 @@ GUICharDefMenu::GUICharDefMenu(
fetchPlayerSkin(); fetchPlayerSkin();
changeCtype("");
m_skintone_types["white"] = wgettext("White Skin"); m_skintone_types["white"] = wgettext("White Skin");
m_skintone_types["red"] = wgettext("Red Skin"); m_skintone_types["red"] = wgettext("Red Skin");
m_skintone_types["green"] = wgettext("Green Skin"); m_skintone_types["green"] = wgettext("Green Skin");
@ -114,6 +115,7 @@ GUICharDefMenu::GUICharDefMenu(
m_shoes_types["leather"] = wgettext("Leather Shoes"); m_shoes_types["leather"] = wgettext("Leather Shoes");
m_shoes_types["fur"] = wgettext("Fur Shoes"); m_shoes_types["fur"] = wgettext("Fur Shoes");
m_shoes_types["canvas"] = wgettext("Canvas Shoes"); m_shoes_types["canvas"] = wgettext("Canvas Shoes");
changeCtype("C");
scene::ISceneManager* smgr = device->getSceneManager(); scene::ISceneManager* smgr = device->getSceneManager();
@ -227,7 +229,7 @@ void GUICharDefMenu::regenerateGui(v2u32 screensize)
gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Create Your Character"), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Create Your Character"), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
changeCtype("C"); //changeCtype("C");
// gender // gender
{ {
core::rect<s32> rect(0, 0, 105, 30); core::rect<s32> rect(0, 0, 105, 30);
@ -266,14 +268,14 @@ void GUICharDefMenu::regenerateGui(v2u32 screensize)
// skintone // skintone
//185 //185
changeCtype(""); //changeCtype("");
{ {
core::rect<s32> rect(0, 0, 160, 20); core::rect<s32> rect(0, 0, 160, 20);
rect += rightside + v2s32(45, 170); rect += rightside + v2s32(45, 170);
gui::IGUIStaticText *t = Environment->addStaticText(m_skintone_types[m_parts["skintone"]].c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(m_skintone_types[m_parts["skintone"]].c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
changeCtype("C"); //changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 30, 30); core::rect<s32> rect(0, 0, 30, 30);
rect += rightside + v2s32(15, 165); rect += rightside + v2s32(15, 165);
@ -287,14 +289,14 @@ void GUICharDefMenu::regenerateGui(v2u32 screensize)
// face // face
//220 //220
changeCtype(""); //changeCtype("");
{ {
core::rect<s32> rect(0, 0, 160, 20); core::rect<s32> rect(0, 0, 160, 20);
rect += rightside + v2s32(45, 205); rect += rightside + v2s32(45, 205);
gui::IGUIStaticText *t = Environment->addStaticText(m_face_types[m_parts["face"]].c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(m_face_types[m_parts["face"]].c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
changeCtype("C"); //changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 30, 30); core::rect<s32> rect(0, 0, 30, 30);
rect += rightside + v2s32(15, 200); rect += rightside + v2s32(15, 200);
@ -308,14 +310,14 @@ void GUICharDefMenu::regenerateGui(v2u32 screensize)
// hairtone // hairtone
//255 //255
changeCtype(""); //changeCtype("");
{ {
core::rect<s32> rect(0, 0, 160, 20); core::rect<s32> rect(0, 0, 160, 20);
rect += rightside + v2s32(45, 240); rect += rightside + v2s32(45, 240);
gui::IGUIStaticText *t = Environment->addStaticText(m_hairtone_types[m_parts["hairtone"]].c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(m_hairtone_types[m_parts["hairtone"]].c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
changeCtype("C"); //changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 30, 30); core::rect<s32> rect(0, 0, 30, 30);
rect += rightside + v2s32(15, 235); rect += rightside + v2s32(15, 235);
@ -329,14 +331,14 @@ void GUICharDefMenu::regenerateGui(v2u32 screensize)
// hair // hair
//290 //290
changeCtype(""); //changeCtype("");
{ {
core::rect<s32> rect(0, 0, 160, 20); core::rect<s32> rect(0, 0, 160, 20);
rect += rightside + v2s32(45, 275); rect += rightside + v2s32(45, 275);
gui::IGUIStaticText *t = Environment->addStaticText(m_hair_types[m_parts["hair"]].c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(m_hair_types[m_parts["hair"]].c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
changeCtype("C"); //changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 30, 30); core::rect<s32> rect(0, 0, 30, 30);
rect += rightside + v2s32(15, 270); rect += rightside + v2s32(15, 270);
@ -350,14 +352,14 @@ void GUICharDefMenu::regenerateGui(v2u32 screensize)
// eyes // eyes
//325 //325
changeCtype(""); //changeCtype("");
{ {
core::rect<s32> rect(0, 0, 160, 20); core::rect<s32> rect(0, 0, 160, 20);
rect += rightside + v2s32(45, 315); rect += rightside + v2s32(45, 315);
gui::IGUIStaticText *t = Environment->addStaticText(m_eyes_types[m_parts["eyes"]].c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(m_eyes_types[m_parts["eyes"]].c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
changeCtype("C"); //changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 30, 30); core::rect<s32> rect(0, 0, 30, 30);
rect += rightside + v2s32(15, 305); rect += rightside + v2s32(15, 305);
@ -371,14 +373,14 @@ void GUICharDefMenu::regenerateGui(v2u32 screensize)
// t-shirt // t-shirt
//370 //370
changeCtype(""); //changeCtype("");
{ {
core::rect<s32> rect(0, 0, 160, 20); core::rect<s32> rect(0, 0, 160, 20);
rect += rightside + v2s32(45, 355); rect += rightside + v2s32(45, 355);
gui::IGUIStaticText *t = Environment->addStaticText(m_shirt_types[m_parts["shirt"]].c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(m_shirt_types[m_parts["shirt"]].c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
changeCtype("C"); //changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 30, 30); core::rect<s32> rect(0, 0, 30, 30);
rect += rightside + v2s32(15, 350); rect += rightside + v2s32(15, 350);
@ -392,14 +394,14 @@ void GUICharDefMenu::regenerateGui(v2u32 screensize)
// pants // pants
//405 //405
changeCtype(""); //changeCtype("");
{ {
core::rect<s32> rect(0, 0, 160, 20); core::rect<s32> rect(0, 0, 160, 20);
rect += rightside + v2s32(45, 390); rect += rightside + v2s32(45, 390);
gui::IGUIStaticText *t = Environment->addStaticText(m_pants_types[m_parts["pants"]].c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(m_pants_types[m_parts["pants"]].c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
changeCtype("C"); //changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 30, 30); core::rect<s32> rect(0, 0, 30, 30);
rect += rightside + v2s32(15, 385); rect += rightside + v2s32(15, 385);
@ -413,14 +415,14 @@ void GUICharDefMenu::regenerateGui(v2u32 screensize)
// shoes // shoes
//440 //440
changeCtype(""); //changeCtype("");
{ {
core::rect<s32> rect(0, 0, 160, 20); core::rect<s32> rect(0, 0, 160, 20);
rect += rightside + v2s32(45, 425); rect += rightside + v2s32(45, 425);
gui::IGUIStaticText *t = Environment->addStaticText(m_shoes_types[m_parts["shoes"]].c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(m_shoes_types[m_parts["shoes"]].c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
changeCtype("C"); //changeCtype("C");
{ {
core::rect<s32> rect(0, 0, 30, 30); core::rect<s32> rect(0, 0, 30, 30);
rect += rightside + v2s32(15, 420); rect += rightside + v2s32(15, 420);
@ -443,6 +445,7 @@ void GUICharDefMenu::regenerateGui(v2u32 screensize)
rect += rightside + v2s32(130, 460); rect += rightside + v2s32(130, 460);
Environment->addButton(rect, this, GUI_ID_CD_QUIT_BUTTON, wgettext("Cancel")); Environment->addButton(rect, this, GUI_ID_CD_QUIT_BUTTON, wgettext("Cancel"));
} }
changeCtype("C");
} }
void GUICharDefMenu::drawMenu() void GUICharDefMenu::drawMenu()

View File

@ -265,7 +265,7 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
core::rect<s32> imgrect(0,0,imgsize,imgsize); core::rect<s32> imgrect(0,0,imgsize,imgsize);
std::string selected = ""; std::wstring selected = L"";
for(s32 i=0; i<itemcount; i++) for(s32 i=0; i<itemcount; i++)
{ {
@ -288,7 +288,7 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
drawInventoryItem(driver, font, item, rect, NULL); drawInventoryItem(driver, font, item, rect, NULL);
std::wstring name = item->getGuiName(); std::wstring name = item->getGuiName();
if (name != L"") if (name != L"")
selected = wide_to_narrow(name); selected = name;
} }
}else{ }else{
video::SColor bgcolor2(128,0,0,0); video::SColor bgcolor2(128,0,0,0);
@ -343,8 +343,8 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
} }
bar_base.Y -= 20; bar_base.Y -= 20;
} }
if (selected != "") { if (selected != L"") {
v2u32 dim = font->getDimension(narrow_to_wide(selected).c_str()); v2u32 dim = font->getDimension(selected.c_str());
v2s32 sdim(dim.X,dim.Y); v2s32 sdim(dim.X,dim.Y);
v2s32 p = pos + v2s32(170, -(24+(sdim.Y-16))); v2s32 p = pos + v2s32(170, -(24+(sdim.Y-16)));
@ -352,8 +352,9 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
p, p,
sdim sdim
); );
font->draw(selected.c_str(), rect2, changeCtype("");
video::SColor(255,255,255,255), false, false, NULL); font->draw(selected.c_str(), rect2, video::SColor(255,255,255,255), false, false, NULL);
changeCtype("C");
} }
} }
@ -730,6 +731,7 @@ void drawLoadingScreen(video::IVideoDriver* driver, const std::wstring msg)
} }
if (guienv) { if (guienv) {
std::wstring m; std::wstring m;
changeCtype("");
if (msg != L"") { if (msg != L"") {
m = msg; m = msg;
}else{ }else{
@ -740,6 +742,7 @@ void drawLoadingScreen(video::IVideoDriver* driver, const std::wstring msg)
gui::IGUIStaticText *guitext = guienv->addStaticText(m.c_str(),rect); gui::IGUIStaticText *guitext = guienv->addStaticText(m.c_str(),rect);
guienv->drawAll(); guienv->drawAll();
guitext->remove(); guitext->remove();
changeCtype("C");
} }
driver->endScene(); driver->endScene();
@ -807,7 +810,9 @@ void the_game(
Draw "Loading" screen Draw "Loading" screen
*/ */
//draw_load_screen(L"Loading...", driver, font); //draw_load_screen(L"Loading...", driver, font);
changeCtype("");
drawLoadingScreen(driver,wgettext("Loading...")); drawLoadingScreen(driver,wgettext("Loading..."));
changeCtype("C");
/* /*
Create server. Create server.
@ -816,7 +821,9 @@ void the_game(
SharedPtr<Server> server; SharedPtr<Server> server;
if(address == ""){ if(address == ""){
//draw_load_screen(L"Creating server...", driver, font); //draw_load_screen(L"Creating server...", driver, font);
changeCtype("");
drawLoadingScreen(driver,wgettext("Creating server...")); drawLoadingScreen(driver,wgettext("Creating server..."));
changeCtype("C");
infostream<<"Creating server"<<std::endl; infostream<<"Creating server"<<std::endl;
server = new Server(map_dir, configpath); server = new Server(map_dir, configpath);
server->start(port); server->start(port);
@ -827,12 +834,16 @@ void the_game(
*/ */
//draw_load_screen(L"Creating client...", driver, font); //draw_load_screen(L"Creating client...", driver, font);
changeCtype("");
drawLoadingScreen(driver,wgettext("Creating client...")); drawLoadingScreen(driver,wgettext("Creating client..."));
changeCtype("C");
infostream<<"Creating client"<<std::endl; infostream<<"Creating client"<<std::endl;
MapDrawControl draw_control; MapDrawControl draw_control;
Client client(device, playername.c_str(), password, draw_control, sound); Client client(device, playername.c_str(), password, draw_control, sound);
changeCtype("");
drawLoadingScreen(driver,wgettext("Resolving address...")); drawLoadingScreen(driver,wgettext("Resolving address..."));
changeCtype("C");
Address connect_address(0,0,0,0, port); Address connect_address(0,0,0,0, port);
try{ try{
if(address == "") if(address == "")
@ -877,6 +888,7 @@ void the_game(
break; break;
} }
changeCtype("");
wchar_t buff[512]; wchar_t buff[512];
int tot = (10.0 - time_counter + 1.0); int tot = (10.0 - time_counter + 1.0);
swprintf( swprintf(
@ -891,7 +903,7 @@ void the_game(
); );
//draw_load_screen(ss.str(), driver, font); //draw_load_screen(ss.str(), driver, font);
drawLoadingScreen(driver,std::wstring(buff)); drawLoadingScreen(driver,std::wstring(buff));
changeCtype("C");
// Update client and server // Update client and server
client.step(0.1); client.step(0.1);
@ -2367,7 +2379,9 @@ void the_game(
generator and other stuff quits generator and other stuff quits
*/ */
{ {
changeCtype("");
drawLoadingScreen(driver,wgettext("Shutting down...")); drawLoadingScreen(driver,wgettext("Shutting down..."));
changeCtype("C");
} }
} }

View File

@ -24,6 +24,16 @@ inline void init_gettext(const char *path) {
#endif #endif
} }
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;
}
inline wchar_t* chartowchar_t(const char *str) inline wchar_t* chartowchar_t(const char *str)
{ {
size_t l = strlen(str)+1; size_t l = strlen(str)+1;
@ -34,22 +44,18 @@ inline wchar_t* chartowchar_t(const char *str)
inline wchar_t* wgettext(const char *str) inline wchar_t* wgettext(const char *str)
{ {
return chartowchar_t(gettext(str)); changeCtype("");
wchar_t *r = chartowchar_t(gettext(str));
changeCtype("C");
return r;
} }
inline wchar_t* wngettext(const char *str1, const char *str2, int n) inline wchar_t* wngettext(const char *str1, const char *str2, int n)
{ {
return chartowchar_t(ngettext(str1,str2,n)); changeCtype("");
} wchar_t *r = chartowchar_t(ngettext(str1,str2,n));
changeCtype("C");
inline void changeCtype(const char *l) return r;
{
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;
} }
#define GETTEXT_HEADER #define GETTEXT_HEADER
#endif #endif

View File

@ -390,6 +390,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
DesiredRect = rect; DesiredRect = rect;
recalculateAbsolutePosition(false); recalculateAbsolutePosition(false);
changeCtype("");
// Character Creator button // Character Creator button
{ {
core::rect<s32> rect(0, 0, 200, 40); core::rect<s32> rect(0, 0, 200, 40);
@ -426,6 +427,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
rect += v2s32(35, 440); rect += v2s32(35, 440);
Environment->addButton(rect, this, GUI_ID_TAB_QUIT, wgettext("Quit")); Environment->addButton(rect, this, GUI_ID_TAB_QUIT, wgettext("Quit"));
} }
changeCtype("C");
v2s32 topleft_content(250, 0); v2s32 topleft_content(250, 0);
v2s32 size_content = size - v2s32(300, 0); v2s32 size_content = size - v2s32(300, 0);

View File

@ -1130,7 +1130,9 @@ int main(int argc, char *argv[])
// If font was not found, this will get us one // If font was not found, this will get us one
font = skin->getFont(); font = skin->getFont();
assert(font); assert(font);
changeCtype("");
drawLoadingScreen(driver,wgettext("Setting Up UI")); drawLoadingScreen(driver,wgettext("Setting Up UI"));
changeCtype("C");
u32 text_height = font->getDimension(L"Hello, world!").Height; u32 text_height = font->getDimension(L"Hello, world!").Height;
infostream<<"text_height="<<text_height<<std::endl; infostream<<"text_height="<<text_height<<std::endl;
@ -1153,9 +1155,13 @@ int main(int argc, char *argv[])
Preload some textures and stuff Preload some textures and stuff
*/ */
changeCtype("");
drawLoadingScreen(driver,wgettext("Loading MapNodes")); drawLoadingScreen(driver,wgettext("Loading MapNodes"));
changeCtype("C");
init_mapnode(driver); // Second call with g_texturesource set init_mapnode(driver); // Second call with g_texturesource set
changeCtype("");
drawLoadingScreen(driver,wgettext("Loading Creatures")); drawLoadingScreen(driver,wgettext("Loading Creatures"));
changeCtype("C");
content_mob_init(); content_mob_init();
/* /*

View File

@ -271,31 +271,45 @@ void init_mapnode()
Initialize mapnode content Initialize mapnode content
*/ */
#ifndef SERVER #ifndef SERVER
changeCtype("");
drawLoadingScreen(driver,wgettext("Loading Base MapNodes")); drawLoadingScreen(driver,wgettext("Loading Base MapNodes"));
changeCtype("C");
#endif #endif
content_mapnode_init(repeat); content_mapnode_init(repeat);
#ifndef SERVER #ifndef SERVER
changeCtype("");
drawLoadingScreen(driver,wgettext("Loading Circuit MapNodes")); drawLoadingScreen(driver,wgettext("Loading Circuit MapNodes"));
changeCtype("C");
#endif #endif
content_mapnode_circuit(repeat); content_mapnode_circuit(repeat);
#ifndef SERVER #ifndef SERVER
changeCtype("");
drawLoadingScreen(driver,wgettext("Loading Plant MapNodes")); drawLoadingScreen(driver,wgettext("Loading Plant MapNodes"));
changeCtype("C");
#endif #endif
content_mapnode_plants(repeat); content_mapnode_plants(repeat);
#ifndef SERVER #ifndef SERVER
changeCtype("");
drawLoadingScreen(driver,wgettext("Loading Farming MapNodes")); drawLoadingScreen(driver,wgettext("Loading Farming MapNodes"));
changeCtype("C");
#endif #endif
content_mapnode_farm(repeat); content_mapnode_farm(repeat);
#ifndef SERVER #ifndef SERVER
changeCtype("");
drawLoadingScreen(driver,wgettext("Loading Decorative MapNodes")); drawLoadingScreen(driver,wgettext("Loading Decorative MapNodes"));
changeCtype("C");
#endif #endif
content_mapnode_furniture(repeat); content_mapnode_furniture(repeat);
#ifndef SERVER #ifndef SERVER
changeCtype("");
drawLoadingScreen(driver,wgettext("Loading Interactive MapNodes")); drawLoadingScreen(driver,wgettext("Loading Interactive MapNodes"));
changeCtype("C");
#endif #endif
content_mapnode_door(repeat); content_mapnode_door(repeat);
#ifndef SERVER #ifndef SERVER
changeCtype("");
drawLoadingScreen(driver,wgettext("Loading Special MapNodes")); drawLoadingScreen(driver,wgettext("Loading Special MapNodes"));
changeCtype("C");
#endif #endif
content_mapnode_stair(repeat); content_mapnode_stair(repeat);
content_mapnode_slab(repeat); content_mapnode_slab(repeat);