From 7eabde6aeeea1a8fa6597c4865422961a944244b Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 4 Jun 2012 23:24:31 +0300 Subject: Use gettext for more basic user interface strings --- src/guiKeyChangeMenu.cpp | 8 ++-- src/guiMainMenu.cpp | 10 ++--- src/main.cpp | 101 ++++++++++++++++++++++++----------------------- 3 files changed, 60 insertions(+), 59 deletions(-) diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp index fb49ab659..f703fcb51 100644 --- a/src/guiKeyChangeMenu.cpp +++ b/src/guiKeyChangeMenu.cpp @@ -105,14 +105,14 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize) v2s32 topleft(0, 0); changeCtype(""); { - core::rect < s32 > rect(0, 0, 500, 20); + core::rect < s32 > rect(0, 0, 600, 40); rect += topleft + v2s32(25, 3); //gui::IGUIStaticText *t = - Environment->addStaticText(wgettext("KEYBINDINGS (If this menu screws up, see minetest.conf)"), + Environment->addStaticText(wgettext("Keybindings. (If this menu screws up, remove stuff from minetest.conf)"), rect, false, true, this, -1); //t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } - v2s32 offset(25, 40); + v2s32 offset(25, 60); // buttons { @@ -299,7 +299,7 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize) } //next col - offset = v2s32(250, 40); + offset = v2s32(250, 60); { core::rect < s32 > rect(0, 0, 100, 20); rect += topleft + v2s32(offset.X, offset.Y); diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index 00bbdb506..f38e491a4 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -214,11 +214,11 @@ void GUIMainMenu::regenerateGui(v2u32 screensize) rect += m_topleft_client + v2s32(0, -30); gui::IGUITabControl *e = Environment->addTabControl( rect, this, true, true, GUI_ID_TAB_CONTROL); - e->addTab(L"Singleplayer"); - e->addTab(L"Multiplayer"); - e->addTab(L"Advanced"); - e->addTab(L"Settings"); - e->addTab(L"Credits"); + e->addTab(wgettext("Singleplayer")); + e->addTab(wgettext("Multiplayer")); + e->addTab(wgettext("Advanced")); + e->addTab(wgettext("Settings")); + e->addTab(wgettext("Credits")); e->setActiveTab(m_data->selected_tab); } #endif diff --git a/src/main.cpp b/src/main.cpp index b133722c3..10c83824a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -778,46 +778,46 @@ int main(int argc, char *argv[]) // List all allowed options core::map allowed_options; allowed_options.insert("help", ValueSpec(VALUETYPE_FLAG, - "Show allowed options")); + _("Show allowed options"))); allowed_options.insert("config", ValueSpec(VALUETYPE_STRING, - "Load configuration from specified file")); + _("Load configuration from specified file"))); allowed_options.insert("port", ValueSpec(VALUETYPE_STRING, - "Set network port (UDP)")); + _("Set network port (UDP)"))); allowed_options.insert("disable-unittests", ValueSpec(VALUETYPE_FLAG, - "Disable unit tests")); + _("Disable unit tests"))); allowed_options.insert("enable-unittests", ValueSpec(VALUETYPE_FLAG, - "Enable unit tests")); + _("Enable unit tests"))); allowed_options.insert("map-dir", ValueSpec(VALUETYPE_STRING, - "Same as --world (deprecated)")); + _("Same as --world (deprecated)"))); allowed_options.insert("world", ValueSpec(VALUETYPE_STRING, - "Set world path (implies local game) ('list' lists all)")); + _("Set world path (implies local game) ('list' lists all)"))); allowed_options.insert("worldname", ValueSpec(VALUETYPE_STRING, - "Set world by name (implies local game)")); + _("Set world by name (implies local game)"))); allowed_options.insert("info", ValueSpec(VALUETYPE_FLAG, - "Print more information to console")); + _("Print more information to console"))); allowed_options.insert("verbose", ValueSpec(VALUETYPE_FLAG, - "Print even more information to console")); + _("Print even more information to console"))); allowed_options.insert("trace", ValueSpec(VALUETYPE_FLAG, - "Print enormous amounts of information to log and console")); + _("Print enormous amounts of information to log and console"))); allowed_options.insert("logfile", ValueSpec(VALUETYPE_STRING, - "Set logfile path ('' = no logging)")); + _("Set logfile path ('' = no logging)"))); allowed_options.insert("gameid", ValueSpec(VALUETYPE_STRING, - "Set gameid (\"--gameid list\" prints available ones)")); + _("Set gameid (\"--gameid list\" prints available ones)"))); #ifndef SERVER allowed_options.insert("speedtests", ValueSpec(VALUETYPE_FLAG, - "Run speed tests")); + _("Run speed tests"))); allowed_options.insert("address", ValueSpec(VALUETYPE_STRING, - "Address to connect to. ('' = local game)")); + _("Address to connect to. ('' = local game)"))); allowed_options.insert("random-input", ValueSpec(VALUETYPE_FLAG, - "Enable random user input, for testing")); + _("Enable random user input, for testing"))); allowed_options.insert("server", ValueSpec(VALUETYPE_FLAG, - "Run dedicated server")); + _("Run dedicated server"))); allowed_options.insert("name", ValueSpec(VALUETYPE_STRING, - "Set player name")); + _("Set player name"))); allowed_options.insert("password", ValueSpec(VALUETYPE_STRING, - "Set password")); + _("Set password"))); allowed_options.insert("go", ValueSpec(VALUETYPE_FLAG, - "Disable main menu")); + _("Disable main menu"))); #endif Settings cmd_args; @@ -826,7 +826,7 @@ int main(int argc, char *argv[]) if(ret == false || cmd_args.getFlag("help") || cmd_args.exists("nonopt1")) { - dstream<<"Allowed options:"<::Iterator i = allowed_options.getIterator(); i.atEnd() == false; i++) @@ -836,7 +836,7 @@ int main(int argc, char *argv[]) if(i.getNode()->getValue().type == VALUETYPE_FLAG) {} else - os1<<" "; + os1<<_(" "); dstream<getValue().help != NULL) @@ -853,7 +853,7 @@ int main(int argc, char *argv[]) // If trace is enabled, enable logging of certain things if(cmd_args.getFlag("trace")){ - dstream<<"Enabling trace level debug output"< worldspecs = getAvailableWorlds(); print_worldspecs(worldspecs, dstream); return 0; @@ -920,7 +920,7 @@ int main(int argc, char *argv[]) // Print startup message infostream< worldmt.size() && commanded_world.substr(commanded_world.size()-worldmt.size()) == worldmt){ - dstream<<"Supplied world.mt file - stripping it off."< 1){ - dstream<<"Multiple worlds are available."<" - <<" or --world "<" + " or --world ")<run() && kill == false) { // Set the window caption - device->setWindowCaption(L"Minetest [Main Menu]"); + device->setWindowCaption((std::wstring(L"Minetest [")+wgettext("Main Menu")+L"]").c_str()); // This is used for catching disconnects try @@ -1461,7 +1461,7 @@ int main(int argc, char *argv[]) // If a world was commanded, append and select it if(commanded_world != ""){ std::string gameid = getWorldGameId(commanded_world, true); - std::string name = "[--world parameter]"; + std::string name = _("[--world parameter]"); if(gameid == ""){ gameid = g_settings->get("default_game"); name += " [new]"; @@ -1598,7 +1598,7 @@ int main(int argc, char *argv[]) + wide_to_narrow(menudata.create_world_name); // Create world if it doesn't exist if(!initializeWorld(path, menudata.create_world_gameid)){ - error_message = L"Failed to initialize world"; + error_message = wgettext("Failed to initialize world"); errorstream<