Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use gettext for more basic user interface strings

  • Loading branch information...
commit 7eabde6aeeea1a8fa6597c4865422961a944244b 1 parent ed772da
celeron55 authored June 04, 2012
8  src/guiKeyChangeMenu.cpp
@@ -105,14 +105,14 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
105 105
 	v2s32 topleft(0, 0);
106 106
 	changeCtype("");
107 107
 	{
108  
-		core::rect < s32 > rect(0, 0, 500, 20);
  108
+		core::rect < s32 > rect(0, 0, 600, 40);
109 109
 		rect += topleft + v2s32(25, 3);
110 110
 		//gui::IGUIStaticText *t =
111  
-		Environment->addStaticText(wgettext("KEYBINDINGS (If this menu screws up, see minetest.conf)"),
  111
+		Environment->addStaticText(wgettext("Keybindings. (If this menu screws up, remove stuff from minetest.conf)"),
112 112
 				rect, false, true, this, -1);
113 113
 		//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
114 114
 	}
115  
-	v2s32 offset(25, 40);
  115
+	v2s32 offset(25, 60);
116 116
 	// buttons
117 117
 
118 118
 	{
@@ -299,7 +299,7 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
299 299
 	}
300 300
 
301 301
 	//next col
302  
-	offset = v2s32(250, 40);
  302
+	offset = v2s32(250, 60);
303 303
 	{
304 304
 		core::rect < s32 > rect(0, 0, 100, 20);
305 305
 		rect += topleft + v2s32(offset.X, offset.Y);
10  src/guiMainMenu.cpp
@@ -214,11 +214,11 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
214 214
 		rect += m_topleft_client + v2s32(0, -30);
215 215
 		gui::IGUITabControl *e = Environment->addTabControl(
216 216
 				rect, this, true, true, GUI_ID_TAB_CONTROL);
217  
-		e->addTab(L"Singleplayer");
218  
-		e->addTab(L"Multiplayer");
219  
-		e->addTab(L"Advanced");
220  
-		e->addTab(L"Settings");
221  
-		e->addTab(L"Credits");
  217
+		e->addTab(wgettext("Singleplayer"));
  218
+		e->addTab(wgettext("Multiplayer"));
  219
+		e->addTab(wgettext("Advanced"));
  220
+		e->addTab(wgettext("Settings"));
  221
+		e->addTab(wgettext("Credits"));
222 222
 		e->setActiveTab(m_data->selected_tab);
223 223
 	}
224 224
 #endif
101  src/main.cpp
@@ -778,46 +778,46 @@ int main(int argc, char *argv[])
778 778
 	// List all allowed options
779 779
 	core::map<std::string, ValueSpec> allowed_options;
780 780
 	allowed_options.insert("help", ValueSpec(VALUETYPE_FLAG,
781  
-			"Show allowed options"));
  781
+			_("Show allowed options")));
782 782
 	allowed_options.insert("config", ValueSpec(VALUETYPE_STRING,
783  
-			"Load configuration from specified file"));
  783
+			_("Load configuration from specified file")));
784 784
 	allowed_options.insert("port", ValueSpec(VALUETYPE_STRING,
785  
-			"Set network port (UDP)"));
  785
+			_("Set network port (UDP)")));
786 786
 	allowed_options.insert("disable-unittests", ValueSpec(VALUETYPE_FLAG,
787  
-			"Disable unit tests"));
  787
+			_("Disable unit tests")));
788 788
 	allowed_options.insert("enable-unittests", ValueSpec(VALUETYPE_FLAG,
789  
-			"Enable unit tests"));
  789
+			_("Enable unit tests")));
790 790
 	allowed_options.insert("map-dir", ValueSpec(VALUETYPE_STRING,
791  
-			"Same as --world (deprecated)"));
  791
+			_("Same as --world (deprecated)")));
792 792
 	allowed_options.insert("world", ValueSpec(VALUETYPE_STRING,
793  
-			"Set world path (implies local game) ('list' lists all)"));
  793
+			_("Set world path (implies local game) ('list' lists all)")));
794 794
 	allowed_options.insert("worldname", ValueSpec(VALUETYPE_STRING,
795  
-			"Set world by name (implies local game)"));
  795
+			_("Set world by name (implies local game)")));
796 796
 	allowed_options.insert("info", ValueSpec(VALUETYPE_FLAG,
797  
-			"Print more information to console"));
  797
+			_("Print more information to console")));
798 798
 	allowed_options.insert("verbose", ValueSpec(VALUETYPE_FLAG,
799  
-			"Print even more information to console"));
  799
+			_("Print even more information to console")));
800 800
 	allowed_options.insert("trace", ValueSpec(VALUETYPE_FLAG,
801  
-			"Print enormous amounts of information to log and console"));
  801
+			_("Print enormous amounts of information to log and console")));
802 802
 	allowed_options.insert("logfile", ValueSpec(VALUETYPE_STRING,
803  
-			"Set logfile path ('' = no logging)"));
  803
+			_("Set logfile path ('' = no logging)")));
804 804
 	allowed_options.insert("gameid", ValueSpec(VALUETYPE_STRING,
805  
-			"Set gameid (\"--gameid list\" prints available ones)"));
  805
+			_("Set gameid (\"--gameid list\" prints available ones)")));
806 806
 #ifndef SERVER
807 807
 	allowed_options.insert("speedtests", ValueSpec(VALUETYPE_FLAG,
808  
-			"Run speed tests"));
  808
+			_("Run speed tests")));
809 809
 	allowed_options.insert("address", ValueSpec(VALUETYPE_STRING,
810  
-			"Address to connect to. ('' = local game)"));
  810
+			_("Address to connect to. ('' = local game)")));
811 811
 	allowed_options.insert("random-input", ValueSpec(VALUETYPE_FLAG,
812  
-			"Enable random user input, for testing"));
  812
+			_("Enable random user input, for testing")));
813 813
 	allowed_options.insert("server", ValueSpec(VALUETYPE_FLAG,
814  
-			"Run dedicated server"));
  814
+			_("Run dedicated server")));
815 815
 	allowed_options.insert("name", ValueSpec(VALUETYPE_STRING,
816  
-			"Set player name"));
  816
+			_("Set player name")));
817 817
 	allowed_options.insert("password", ValueSpec(VALUETYPE_STRING,
818  
-			"Set password"));
  818
+			_("Set password")));
819 819
 	allowed_options.insert("go", ValueSpec(VALUETYPE_FLAG,
820  
-			"Disable main menu"));
  820
+			_("Disable main menu")));
821 821
 #endif
822 822
 
823 823
 	Settings cmd_args;
@@ -826,7 +826,7 @@ int main(int argc, char *argv[])
826 826
 
827 827
 	if(ret == false || cmd_args.getFlag("help") || cmd_args.exists("nonopt1"))
828 828
 	{
829  
-		dstream<<"Allowed options:"<<std::endl;
  829
+		dstream<<_("Allowed options:")<<std::endl;
830 830
 		for(core::map<std::string, ValueSpec>::Iterator
831 831
 				i = allowed_options.getIterator();
832 832
 				i.atEnd() == false; i++)
@@ -836,7 +836,7 @@ int main(int argc, char *argv[])
836 836
 			if(i.getNode()->getValue().type == VALUETYPE_FLAG)
837 837
 				{}
838 838
 			else
839  
-				os1<<" <value>";
  839
+				os1<<_(" <value>");
840 840
 			dstream<<padStringRight(os1.str(), 24);
841 841
 
842 842
 			if(i.getNode()->getValue().help != NULL)
@@ -853,7 +853,7 @@ int main(int argc, char *argv[])
853 853
 	
854 854
 	// If trace is enabled, enable logging of certain things
855 855
 	if(cmd_args.getFlag("trace")){
856  
-		dstream<<"Enabling trace level debug output"<<std::endl;
  856
+		dstream<<_("Enabling trace level debug output")<<std::endl;
857 857
 		log_trace_level_enabled = true;
858 858
 		dout_con_ptr = &verbosestream; // this is somewhat old crap
859 859
 		socket_enable_debug_output = true; // socket doesn't use log.h
@@ -912,7 +912,7 @@ int main(int argc, char *argv[])
912 912
 	
913 913
 	// List worlds if requested
914 914
 	if(cmd_args.exists("world") && cmd_args.get("world") == "list"){
915  
-		dstream<<"Available worlds:"<<std::endl;
  915
+		dstream<<_("Available worlds:")<<std::endl;
916 916
 		std::vector<WorldSpec> worldspecs = getAvailableWorlds();
917 917
 		print_worldspecs(worldspecs, dstream);
918 918
 		return 0;
@@ -920,7 +920,7 @@ int main(int argc, char *argv[])
920 920
 	
921 921
 	// Print startup message
922 922
 	infostream<<PROJECT_NAME<<
923  
-			" with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST
  923
+			" "<<_("with")<<" SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST
924 924
 			<<", "<<BUILD_INFO
925 925
 			<<std::endl;
926 926
 	
@@ -1032,7 +1032,7 @@ int main(int argc, char *argv[])
1032 1032
 		if(commanded_world.size() > worldmt.size() &&
1033 1033
 				commanded_world.substr(commanded_world.size()-worldmt.size())
1034 1034
 				== worldmt){
1035  
-			dstream<<"Supplied world.mt file - stripping it off."<<std::endl;
  1035
+			dstream<<_("Supplied world.mt file - stripping it off.")<<std::endl;
1036 1036
 			commanded_world = commanded_world.substr(
1037 1037
 					0, commanded_world.size()-worldmt.size());
1038 1038
 		}
@@ -1047,8 +1047,8 @@ int main(int argc, char *argv[])
1047 1047
 			std::string name = worldspecs[i].name;
1048 1048
 			if(name == commanded_worldname){
1049 1049
 				if(commanded_world != ""){
1050  
-					dstream<<"--worldname takes precedence over previously "
1051  
-							<<"selected world."<<std::endl;
  1050
+					dstream<<_("--worldname takes precedence over previously "
  1051
+							"selected world.")<<std::endl;
1052 1052
 				}
1053 1053
 				commanded_world = worldspecs[i].path;
1054 1054
 				found = true;
@@ -1056,8 +1056,8 @@ int main(int argc, char *argv[])
1056 1056
 			}
1057 1057
 		}
1058 1058
 		if(!found){
1059  
-			dstream<<"World '"<<commanded_worldname<<"' not "
1060  
-					<<"available. Available worlds:"<<std::endl;
  1059
+			dstream<<_("World")<<" '"<<commanded_worldname<<_("' not "
  1060
+					"available. Available worlds:")<<std::endl;
1061 1061
 			print_worldspecs(worldspecs, dstream);
1062 1062
 			return 1;
1063 1063
 		}
@@ -1092,7 +1092,7 @@ int main(int argc, char *argv[])
1092 1092
 
1093 1093
 		// World directory
1094 1094
 		std::string world_path;
1095  
-		verbosestream<<"Determining world path"<<std::endl;
  1095
+		verbosestream<<_("Determining world path")<<std::endl;
1096 1096
 		bool is_legacy_world = false;
1097 1097
 		// If a world was commanded, use it
1098 1098
 		if(commanded_world != ""){
@@ -1116,8 +1116,8 @@ int main(int argc, char *argv[])
1116 1116
 					}
1117 1117
 				}
1118 1118
 				if(world_path == ""){
1119  
-					dstream<<"World '"<<commanded_worldname<<"' not "
1120  
-							<<"available. Available worlds:"<<std::endl;
  1119
+					dstream<<_("World")<<" '"<<commanded_worldname<<"' "<<_("not "
  1120
+							"available. Available worlds:")<<std::endl;
1121 1121
 					print_worldspecs(worldspecs, dstream);
1122 1122
 					return 1;
1123 1123
 				}
@@ -1125,13 +1125,13 @@ int main(int argc, char *argv[])
1125 1125
 			// If there is only a single world, use it
1126 1126
 			if(worldspecs.size() == 1){
1127 1127
 				world_path = worldspecs[0].path;
1128  
-				dstream<<"Automatically selecting world at ["
  1128
+				dstream<<_("Automatically selecting world at")<<" ["
1129 1129
 						<<world_path<<"]"<<std::endl;
1130 1130
 			// If there are multiple worlds, list them
1131 1131
 			} else if(worldspecs.size() > 1){
1132  
-				dstream<<"Multiple worlds are available."<<std::endl;
1133  
-				dstream<<"Please select one using --worldname <name>"
1134  
-						<<" or --world <path>"<<std::endl;
  1132
+				dstream<<_("Multiple worlds are available.")<<std::endl;
  1133
+				dstream<<_("Please select one using --worldname <name>"
  1134
+						" or --world <path>")<<std::endl;
1135 1135
 				print_worldspecs(worldspecs, dstream);
1136 1136
 				return 1;
1137 1137
 			// If there are no worlds, automatically create a new one
@@ -1148,11 +1148,11 @@ int main(int argc, char *argv[])
1148 1148
 			errorstream<<"No world path specified or found."<<std::endl;
1149 1149
 			return 1;
1150 1150
 		}
1151  
-		verbosestream<<"Using world path ["<<world_path<<"]"<<std::endl;
  1151
+		verbosestream<<_("Using world path")<<" ["<<world_path<<"]"<<std::endl;
1152 1152
 
1153 1153
 		// We need a gamespec.
1154 1154
 		SubgameSpec gamespec;
1155  
-		verbosestream<<"Determining gameid/gamespec"<<std::endl;
  1155
+		verbosestream<<_("Determining gameid/gamespec")<<std::endl;
1156 1156
 		// If world doesn't exist
1157 1157
 		if(!getWorldExists(world_path))
1158 1158
 		{
@@ -1191,7 +1191,7 @@ int main(int argc, char *argv[])
1191 1191
 					<<std::endl;
1192 1192
 			return 1;
1193 1193
 		}
1194  
-		verbosestream<<"Using gameid ["<<gamespec.id<<"]"<<std::endl;
  1194
+		verbosestream<<_("Using gameid")<<" ["<<gamespec.id<<"]"<<std::endl;
1195 1195
 
1196 1196
 		// Create server
1197 1197
 		Server server(world_path, configpath, gamespec, false);
@@ -1376,7 +1376,7 @@ int main(int argc, char *argv[])
1376 1376
 	while(device->run() && kill == false)
1377 1377
 	{
1378 1378
 		// Set the window caption
1379  
-		device->setWindowCaption(L"Minetest [Main Menu]");
  1379
+		device->setWindowCaption((std::wstring(L"Minetest [")+wgettext("Main Menu")+L"]").c_str());
1380 1380
 
1381 1381
 		// This is used for catching disconnects
1382 1382
 		try
@@ -1461,7 +1461,7 @@ int main(int argc, char *argv[])
1461 1461
 				// If a world was commanded, append and select it
1462 1462
 				if(commanded_world != ""){
1463 1463
 					std::string gameid = getWorldGameId(commanded_world, true);
1464  
-					std::string name = "[--world parameter]";
  1464
+					std::string name = _("[--world parameter]");
1465 1465
 					if(gameid == ""){
1466 1466
 						gameid = g_settings->get("default_game");
1467 1467
 						name += " [new]";
@@ -1598,7 +1598,7 @@ int main(int argc, char *argv[])
1598 1598
 							+ wide_to_narrow(menudata.create_world_name);
1599 1599
 					// Create world if it doesn't exist
1600 1600
 					if(!initializeWorld(path, menudata.create_world_gameid)){
1601  
-						error_message = L"Failed to initialize world";
  1601
+						error_message = wgettext("Failed to initialize world");
1602 1602
 						errorstream<<wide_to_narrow(error_message)<<std::endl;
1603 1603
 						continue;
1604 1604
 					}
@@ -1610,15 +1610,15 @@ int main(int argc, char *argv[])
1610 1610
 				if(current_address == "")
1611 1611
 				{
1612 1612
 					if(menudata.selected_world == -1){
1613  
-						error_message = L"No world selected and no address "
1614  
-								L"provided. Nothing to do.";
  1613
+						error_message = wgettext("No world selected and no address "
  1614
+								"provided. Nothing to do.");
1615 1615
 						errorstream<<wide_to_narrow(error_message)<<std::endl;
1616 1616
 						continue;
1617 1617
 					}
1618 1618
 					// Load gamespec for required game
1619 1619
 					gamespec = findWorldSubgame(worldspec.path);
1620 1620
 					if(!gamespec.isValid() && !commanded_gamespec.isValid()){
1621  
-						error_message = L"Could not find or load game \""
  1621
+						error_message = wgettext("Could not find or load game \"")
1622 1622
 								+ narrow_to_wide(worldspec.gameid) + L"\"";
1623 1623
 						errorstream<<wide_to_narrow(error_message)<<std::endl;
1624 1624
 						continue;
@@ -1632,7 +1632,8 @@ int main(int argc, char *argv[])
1632 1632
 					}
1633 1633
 
1634 1634
 					if(!gamespec.isValid()){
1635  
-						error_message = L"Invalid gamespec. (world_gameid="
  1635
+						error_message = wgettext("Invalid gamespec.");
  1636
+						error_message += L" (world_gameid="
1636 1637
 								+narrow_to_wide(worldspec.gameid)+L")";
1637 1638
 						errorstream<<wide_to_narrow(error_message)<<std::endl;
1638 1639
 						continue;
@@ -1671,7 +1672,7 @@ int main(int argc, char *argv[])
1671 1672
 		} //try
1672 1673
 		catch(con::PeerNotFoundException &e)
1673 1674
 		{
1674  
-			error_message = L"Connection error (timed out?)";
  1675
+			error_message = wgettext("Connection error (timed out?)");
1675 1676
 			errorstream<<wide_to_narrow(error_message)<<std::endl;
1676 1677
 		}
1677 1678
 		catch(ServerError &e)
@@ -1682,12 +1683,12 @@ int main(int argc, char *argv[])
1682 1683
 		catch(ModError &e)
1683 1684
 		{
1684 1685
 			errorstream<<e.what()<<std::endl;
1685  
-			error_message = narrow_to_wide(e.what()) + L"\nCheck debug.txt for details.";
  1686
+			error_message = narrow_to_wide(e.what()) + wgettext("\nCheck debug.txt for details.");
1686 1687
 		}
1687 1688
 #ifdef NDEBUG
1688 1689
 		catch(std::exception &e)
1689 1690
 		{
1690  
-			std::string narrow_message = "Some exception, what()=\"";
  1691
+			std::string narrow_message = "Some exception: \"";
1691 1692
 			narrow_message += e.what();
1692 1693
 			narrow_message += "\"";
1693 1694
 			errorstream<<narrow_message<<std::endl;

0 notes on commit 7eabde6

Please sign in to comment.
Something went wrong with that request. Please try again.