added gettext support

german translation file
and bashscript to update translations
This commit is contained in:
Constantin Wenger 2011-07-20 16:51:19 +02:00
parent 2095b15816
commit 6a8328de79
11 changed files with 237 additions and 42 deletions

View File

@ -90,6 +90,8 @@ Compiling on Windows:
http://www.winimage.com/zLibDll/index.html http://www.winimage.com/zLibDll/index.html
* Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip): * Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip):
http://www.winimage.com/zLibDll/index.html http://www.winimage.com/zLibDll/index.html
* gettext bibrary and tools:
http://gnuwin32.sourceforge.net/downlinks/gettext.php
* And, of course, Minetest-c55: * And, of course, Minetest-c55:
http://celeron.55.lt/~celeron55/minetest/download http://celeron.55.lt/~celeron55/minetest/download
- Steps: - Steps:
@ -117,6 +119,10 @@ Compiling on Windows:
+ lib + lib
+ include + include
... ...
+ gettext
+bin
+include
+lib
+ minetest + minetest
+ src + src
+ doc + doc
@ -145,6 +151,10 @@ Compiling on Windows:
ZLIB_DLL DIR/zlib125dll/dll32/zlibwapi.dll ZLIB_DLL DIR/zlib125dll/dll32/zlibwapi.dll
ZLIB_INCLUDE_DIR DIR/zlib-1.2.5 ZLIB_INCLUDE_DIR DIR/zlib-1.2.5
ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib
GETTEXT_BIN_DIR DIR/gettext/bin
GETTEXT_INCLUDE_DIR DIR/gettext/include
GETTEXT_LIBRARIES DIR/gettext/lib/intl.lib
GETTEXT_MSGFMT DIR/gettext/bin/msgfmt
----------------- -----------------
- Hit "Configure" - Hit "Configure"
- Hit "Generate" - Hit "Generate"

121
po/de/minetest-c55.po Normal file
View File

@ -0,0 +1,121 @@
# German translations for minetest-c55 package.
# Copyright (C) 2011 celeron
# This file is distributed under the same license as the minetest-c55 package.
# Constantin Wenger <constantin.wenger@googlemail.com>, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: 0.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-07-20 16:03+0200\n"
"PO-Revision-Date: 2011-07-20 16:04+0100\n"
"Last-Translator: Constantin Wenger <constantin.wenger@googlemail.com>\n"
"Language-Team: Deutsch <>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
#: src/guiMainMenu.cpp:173
msgid "Name/Password"
msgstr "Name/Passwort"
#: src/guiMainMenu.cpp:195
msgid "Address/Port"
msgstr "Adresse / Port"
#: src/guiMainMenu.cpp:214
msgid "Leave address blank to start a local server."
msgstr "Lasse die Adresse frei um einen eigenen Server zu starten"
#: src/guiMainMenu.cpp:220
msgid "Fancy trees"
msgstr "Schöne Bäume"
#: src/guiMainMenu.cpp:226
msgid "Smooth Lighting"
msgstr "Besseres Licht"
#: src/guiMainMenu.cpp:233
msgid "Start Game / Connect"
msgstr "Spiel starten / Verbinden"
#: src/guiMainMenu.cpp:256
msgid "Creative Mode"
msgstr "Kreativitätsmodus"
#: src/guiMainMenu.cpp:261
msgid "Enable Damage"
msgstr "Schaden einschalten"
#: src/guiMainMenu.cpp:268
msgid "Delete world"
msgstr "Welt löschen"
#: src/guiMessageMenu.cpp:92
#: src/guiTextInputMenu.cpp:110
msgid "Proceed"
msgstr "Fortsetzen"
#: src/guiPasswordChange.cpp:102
msgid "Old Password"
msgstr "Altes Passwort"
#: src/guiPasswordChange.cpp:116
msgid "New Password"
msgstr "Neues Passwort"
#: src/guiPasswordChange.cpp:129
msgid "Confirm Password"
msgstr "Passwort wiederholen"
#: src/guiPasswordChange.cpp:143
msgid "Change"
msgstr "Ändern"
#: src/guiPasswordChange.cpp:151
msgid "Passwords do not match!"
msgstr "Passwörter passen nicht zusammen"
#: src/guiPauseMenu.cpp:109
msgid "Continue"
msgstr "Weiter"
#: src/guiPauseMenu.cpp:115
msgid "Change Password"
msgstr "Passwort ändern"
#: src/guiPauseMenu.cpp:121
msgid "Disconnect"
msgstr "Verbindung trennen"
#: src/guiPauseMenu.cpp:127
msgid "Exit to OS"
msgstr "Programm beenden"
#: src/guiPauseMenu.cpp:134
msgid ""
"Keys:\n"
"- WASD: Walk\n"
"- Mouse left: dig blocks\n"
"- Mouse right: place blocks\n"
"- Mouse wheel: select item\n"
"- 0...9: select item\n"
"- Shift: sneak\n"
"- R: Toggle viewing all loaded chunks\n"
"- I: Inventory menu\n"
"- ESC: This menu\n"
"- T: Chat\n"
msgstr ""
"Tastenkürzel:\n"
"- WASD: Gehen\n"
"- linke Maustaste: dig blocks\n"
"- rechte Maustaste: place blocks\n"
"- Mausrad: Item auswählen\n"
"- 0...9: Item auswählen\n"
"- Shift: ducken\n"
"- R: Alle geladenen Kartenteile anzeigen, umschalten\n"
"- I: Inventarmenü\n"
"- T: Chat\n"

View File

@ -27,6 +27,14 @@ if(WIN32)
CACHE FILEPATH "Path to zlibwapi.lib") CACHE FILEPATH "Path to zlibwapi.lib")
set(ZLIB_DLL "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.dll" set(ZLIB_DLL "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.dll"
CACHE FILEPATH "Path to zlibwapi.dll (for installation)") CACHE FILEPATH "Path to zlibwapi.dll (for installation)")
set(GETTEXT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../gettext/include"
CACHE PATH "gettext include directory")
set(GETTEXT_BIN_DIR "${PROJECT_SOURCE_DIR}/../../gettext/bin"
CACHE PATH "gettext bin directory")
set(GETTEXT_LIBRARIES "${PROJECT_SOURCE_DIR}/../../gettext/lib/intl.lib"
CACHE FILEPATH "gettext intl.lib")
set(IRRLICHT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../irrlicht-1.7.2"
CACHE PATH "irrlicht dir")
else() else()
# Unix probably # Unix probably
if(BUILD_CLIENT) if(BUILD_CLIENT)
@ -134,6 +142,7 @@ include_directories(
${ZLIB_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
${CMAKE_BUILD_TYPE} ${CMAKE_BUILD_TYPE}
${PNG_INCLUDE_DIR} ${PNG_INCLUDE_DIR}
${GETTEXT_INCLUDE_DIR}
"${PROJECT_SOURCE_DIR}/jthread" "${PROJECT_SOURCE_DIR}/jthread"
"${PROJECT_SOURCE_DIR}/sqlite" "${PROJECT_SOURCE_DIR}/sqlite"
) )
@ -151,6 +160,7 @@ if(BUILD_CLIENT)
${BZIP2_LIBRARIES} ${BZIP2_LIBRARIES}
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${X11_LIBRARIES} ${X11_LIBRARIES}
${GETTEXT_LIBRARIES}
${PLATFORM_LIBS} ${PLATFORM_LIBS}
${CLIENT_PLATFORM_LIBS} ${CLIENT_PLATFORM_LIBS}
jthread jthread
@ -208,6 +218,10 @@ else()
set(ARCH i386) set(ARCH i386)
endif() endif()
if(WIN32)
set(CMAKE_EXE_LINKER_FLAGS "-lintl -L ${GETTEXT_BIN_DIR}")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops") set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O1 -Wall ${WARNING_FLAGS}") set(CMAKE_CXX_FLAGS_DEBUG "-g -O1 -Wall ${WARNING_FLAGS}")
@ -239,6 +253,8 @@ if(BUILD_CLIENT)
install(FILES ${images} DESTINATION ${DATADIR}) install(FILES ${images} DESTINATION ${DATADIR})
install(FILES ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo DESTINATION locale/de/LC_MESSAGES)
if(WIN32) if(WIN32)
if(DEFINED IRRLICHT_DLL) if(DEFINED IRRLICHT_DLL)
install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR}) install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR})
@ -246,6 +262,10 @@ if(BUILD_CLIENT)
if(DEFINED ZLIB_DLL) if(DEFINED ZLIB_DLL)
install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR}) install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR})
endif() endif()
if(DEFINED GETTEXT_BIN_DIR)
install(FILES ${GETTEXT_BIN_DIR}/libintl3.dll DESTINATION ${BINDIR})
install(FILES ${GETTEXT_BIN_DIR}/libiconv2.dll DESTINATION ${BINDIR})
endif()
endif() endif()
endif(BUILD_CLIENT) endif(BUILD_CLIENT)
@ -253,6 +273,27 @@ if(BUILD_SERVER)
install(TARGETS minetestserver DESTINATION ${BINDIR}) install(TARGETS minetestserver DESTINATION ${BINDIR})
endif(BUILD_SERVER) endif(BUILD_SERVER)
if(WIN32)
set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt" CACHE FILEPATH "path to msgfmt")
elseif(APPLE)
set(GETTEXT_MSGFMT "${GETTEXT_BIN_DIR}/msgfmt" CACHE FILEPATH "path to msgfmt")
else()
set(GETTEXT_MSGFMT "msgfmt")
endif()
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES COMMENT "mo-update [de]: Creating locale directory.")
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo
COMMAND ${GETTEXT_MSGFMT} -o ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo ${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po
DEPENDS
${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES
${CMAKE_SOURCE_DIR}/po/de/minetest-c55.po
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po/de
COMMENT "mo-update [de]: Creating mo file."
)
add_custom_target(translation_de ALL COMMENT "mo update [de]" DEPENDS ${CMAKE_BINARY_DIR}/locale/de/LC_MESSAGES/minetest-c55.mo)
# Subdirectories # Subdirectories
add_subdirectory(jthread) add_subdirectory(jthread)

12
src/gettext.h Normal file
View File

@ -0,0 +1,12 @@
#include <libintl.h>
#define _(String) gettext(String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
inline wchar_t* chartowchar_t(char *str)
{
size_t l = strlen(str)+1;
wchar_t* nstr = new wchar_t[l];
mbstowcs(nstr, str, l);
return nstr;
}

View File

@ -25,6 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gettext.h"
GUIMainMenu::GUIMainMenu(gui::IGUIEnvironment* env, GUIMainMenu::GUIMainMenu(gui::IGUIEnvironment* env,
gui::IGUIElement* parent, s32 id, gui::IGUIElement* parent, s32 id,
IMenuManager *menumgr, IMenuManager *menumgr,
@ -175,8 +177,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 110, 20); core::rect<s32> rect(0, 0, 110, 20);
rect += topleft_client + v2s32(35, 50+6); rect += topleft_client + v2s32(35, 50+6);
const wchar_t *text = L"Name/Password"; Environment->addStaticText(chartowchar_t(gettext("Name/Password")), rect, false, true, this, -1);
Environment->addStaticText(text, rect, false, true, this, -1);
} }
{ {
core::rect<s32> rect(0, 0, 230, 30); core::rect<s32> rect(0, 0, 230, 30);
@ -198,8 +199,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 110, 20); core::rect<s32> rect(0, 0, 110, 20);
rect += topleft_client + v2s32(35, 100+6); rect += topleft_client + v2s32(35, 100+6);
const wchar_t *text = L"Address/Port"; Environment->addStaticText(chartowchar_t(gettext("Address/Port")), rect, false, true, this, -1);
Environment->addStaticText(text, rect, false, true, this, -1);
} }
{ {
core::rect<s32> rect(0, 0, 230, 30); core::rect<s32> rect(0, 0, 230, 30);
@ -217,28 +217,26 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
} }
{ {
core::rect<s32> rect(0, 0, 400, 20); core::rect<s32> rect(0, 0, 400, 20);
rect += topleft_client + v2s32(160, 100+35); Environment->addStaticText(chartowchar_t(gettext("Leave address blank to start a local server.")), rect, false, true, this, -1);
const wchar_t *text = L"Leave address blank to start a local server.";
Environment->addStaticText(text, rect, false, true, this, -1);
} }
{ {
core::rect<s32> rect(0, 0, 250, 30); core::rect<s32> rect(0, 0, 250, 30);
rect += topleft_client + v2s32(35, 150); rect += topleft_client + v2s32(35, 150);
Environment->addCheckBox(fancy_trees, rect, this, GUI_ID_FANCYTREE_CB, Environment->addCheckBox(fancy_trees, rect, this, GUI_ID_FANCYTREE_CB,
L"Fancy trees"); chartowchar_t(gettext("Fancy trees")));
} }
{ {
core::rect<s32> rect(0, 0, 250, 30); core::rect<s32> rect(0, 0, 250, 30);
rect += topleft_client + v2s32(35, 150+30); rect += topleft_client + v2s32(35, 150+30);
Environment->addCheckBox(smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB, Environment->addCheckBox(smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB,
L"Smooth Lighting"); chartowchar_t(gettext("Smooth Lighting")));
} }
// Start game button // Start game button
{ {
core::rect<s32> rect(0, 0, 180, 30); core::rect<s32> rect(0, 0, 180, 30);
//rect += topleft_client + v2s32(size_client.X/2-180/2, 225-30/2); //rect += topleft_client + v2s32(size_client.X/2-180/2, 225-30/2);
rect += topleft_client + v2s32(size_client.X-180-40, 150+25); rect += topleft_client + v2s32(size_client.X-180-40, 150+25);
Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, L"Start Game / Connect"); Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON, chartowchar_t(gettext("Start Game / Connect")));
} }
// Key change button // Key change button
@ -246,7 +244,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
core::rect<s32> rect(0, 0, 100, 30); core::rect<s32> rect(0, 0, 100, 30);
//rect += topleft_client + v2s32(size_client.X/2-180/2, 225-30/2); //rect += topleft_client + v2s32(size_client.X/2-180/2, 225-30/2);
rect += topleft_client + v2s32(size_client.X-180-40-100-20, 150+25); rect += topleft_client + v2s32(size_client.X-180-40-100-20, 150+25);
Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON, L"Change keys"); Environment->addButton(rect, this, GUI_ID_CHANGE_KEYS_BUTTON, chartowchar_t(gettext("Change keys")));
} }
/* /*
Server section Server section
@ -268,19 +266,19 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 250, 30); core::rect<s32> rect(0, 0, 250, 30);
rect += topleft_server + v2s32(35, 30); rect += topleft_server + v2s32(35, 30);
Environment->addCheckBox(creative_mode, rect, this, GUI_ID_CREATIVE_CB, L"Creative Mode"); Environment->addCheckBox(creative_mode, rect, this, GUI_ID_CREATIVE_CB, chartowchar_t(gettext("Creative Mode")));
} }
{ {
core::rect<s32> rect(0, 0, 250, 30); core::rect<s32> rect(0, 0, 250, 30);
rect += topleft_server + v2s32(35, 60); rect += topleft_server + v2s32(35, 60);
Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB, L"Enable Damage"); Environment->addCheckBox(enable_damage, rect, this, GUI_ID_DAMAGE_CB, chartowchar_t(gettext("Enable Damage")));
} }
// Map delete button // Map delete button
{ {
core::rect<s32> rect(0, 0, 130, 30); core::rect<s32> rect(0, 0, 130, 30);
//rect += topleft_server + v2s32(size_server.X-40-130, 100+25); //rect += topleft_server + v2s32(size_server.X-40-130, 100+25);
rect += topleft_server + v2s32(40, 100+25); rect += topleft_server + v2s32(40, 100+25);
Environment->addButton(rect, this, GUI_ID_DELETE_MAP_BUTTON, L"Delete map"); Environment->addButton(rect, this, GUI_ID_DELETE_MAP_BUTTON, chartowchar_t(gettext("Delete map")));
} }
} }

View File

@ -22,6 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serialization.h" #include "serialization.h"
#include <string> #include <string>
#include "gettext.h"
GUIMessageMenu::GUIMessageMenu(gui::IGUIEnvironment* env, GUIMessageMenu::GUIMessageMenu(gui::IGUIEnvironment* env,
gui::IGUIElement* parent, s32 id, gui::IGUIElement* parent, s32 id,
IMenuManager *menumgr, IMenuManager *menumgr,
@ -87,7 +89,7 @@ void GUIMessageMenu::regenerateGui(v2u32 screensize)
core::rect<s32> rect(0, 0, 140, 30); core::rect<s32> rect(0, 0, 140, 30);
rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25); rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25);
gui::IGUIElement *e = gui::IGUIElement *e =
Environment->addButton(rect, this, 257, L"Proceed"); Environment->addButton(rect, this, 257, chartowchar_t(gettext("Proceed")));
Environment->setFocus(e); Environment->setFocus(e);
} }
} }

View File

@ -21,6 +21,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "serialization.h" #include "serialization.h"
#include <string> #include <string>
#include "gettext.h"
const int ID_oldPassword = 256; const int ID_oldPassword = 256;
const int ID_newPassword1 = 257; const int ID_newPassword1 = 257;
const int ID_newPassword2 = 258; const int ID_newPassword2 = 258;
@ -97,8 +99,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 110, 20); core::rect<s32> rect(0, 0, 110, 20);
rect += topleft_client + v2s32(35, ypos+6); rect += topleft_client + v2s32(35, ypos+6);
const wchar_t *text = L"Old Password"; Environment->addStaticText(chartowchar_t(gettext("Old Password")), rect, false, true, this, -1);
Environment->addStaticText(text, rect, false, true, this, -1);
} }
{ {
core::rect<s32> rect(0, 0, 230, 30); core::rect<s32> rect(0, 0, 230, 30);
@ -112,8 +113,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 110, 20); core::rect<s32> rect(0, 0, 110, 20);
rect += topleft_client + v2s32(35, ypos+6); rect += topleft_client + v2s32(35, ypos+6);
const wchar_t *text = L"New Password"; Environment->addStaticText(chartowchar_t(gettext("New Password")), rect, false, true, this, -1);
Environment->addStaticText(text, rect, false, true, this, -1);
} }
{ {
core::rect<s32> rect(0, 0, 230, 30); core::rect<s32> rect(0, 0, 230, 30);
@ -126,8 +126,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 110, 20); core::rect<s32> rect(0, 0, 110, 20);
rect += topleft_client + v2s32(35, ypos+6); rect += topleft_client + v2s32(35, ypos+6);
const wchar_t *text = L"Confirm Password"; Environment->addStaticText(chartowchar_t(gettext("Confirm Password")), rect, false, true, this, -1);
Environment->addStaticText(text, rect, false, true, this, -1);
} }
{ {
core::rect<s32> rect(0, 0, 230, 30); core::rect<s32> rect(0, 0, 230, 30);
@ -141,16 +140,15 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 140, 30); core::rect<s32> rect(0, 0, 140, 30);
rect = rect + v2s32(size.X/2-140/2, ypos); rect = rect + v2s32(size.X/2-140/2, ypos);
Environment->addButton(rect, this, ID_change, L"Change"); Environment->addButton(rect, this, ID_change, chartowchar_t(gettext("Change")));
} }
ypos += 50; ypos += 50;
{ {
core::rect<s32> rect(0, 0, 300, 20); core::rect<s32> rect(0, 0, 300, 20);
rect += topleft_client + v2s32(35, ypos); rect += topleft_client + v2s32(35, ypos);
const wchar_t *text = L"Passwords do not match!";
IGUIElement *e = IGUIElement *e =
Environment->addStaticText(text, rect, false, true, this, ID_message); Environment->addStaticText(chartowchar_t(gettext("Passwords do not match!")), rect, false, true, this, ID_message);
e->setVisible(false); e->setVisible(false);
} }

View File

@ -24,6 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "config.h" #include "config.h"
#include "main.h" #include "main.h"
#include "gettext.h"
GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env, GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env,
gui::IGUIElement* parent, s32 id, gui::IGUIElement* parent, s32 id,
IGameCallback *gamecallback, IGameCallback *gamecallback,
@ -104,43 +106,43 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 140, btn_height); core::rect<s32> rect(0, 0, 140, btn_height);
rect = rect + v2s32(size.X/2-140/2, btn_y); rect = rect + v2s32(size.X/2-140/2, btn_y);
Environment->addButton(rect, this, 256, L"Continue"); Environment->addButton(rect, this, 256, chartowchar_t(gettext("Continue")));
} }
btn_y += btn_height + btn_gap; btn_y += btn_height + btn_gap;
{ {
core::rect<s32> rect(0, 0, 140, btn_height); core::rect<s32> rect(0, 0, 140, btn_height);
rect = rect + v2s32(size.X/2-140/2, btn_y); rect = rect + v2s32(size.X/2-140/2, btn_y);
Environment->addButton(rect, this, 261, L"Change Password"); Environment->addButton(rect, this, 261, chartowchar_t(gettext("Change Password")));
} }
btn_y += btn_height + btn_gap; btn_y += btn_height + btn_gap;
{ {
core::rect<s32> rect(0, 0, 140, btn_height); core::rect<s32> rect(0, 0, 140, btn_height);
rect = rect + v2s32(size.X/2-140/2, btn_y); rect = rect + v2s32(size.X/2-140/2, btn_y);
Environment->addButton(rect, this, 260, L"Disconnect"); Environment->addButton(rect, this, 260, chartowchar_t(gettext("Disconnect")));
} }
btn_y += btn_height + btn_gap; btn_y += btn_height + btn_gap;
{ {
core::rect<s32> rect(0, 0, 140, btn_height); core::rect<s32> rect(0, 0, 140, btn_height);
rect = rect + v2s32(size.X/2-140/2, btn_y); rect = rect + v2s32(size.X/2-140/2, btn_y);
Environment->addButton(rect, this, 257, L"Exit to OS"); Environment->addButton(rect, this, 257, chartowchar_t(gettext("Exit to OS")));
} }
{ {
core::rect<s32> rect(0, 0, 180, 240); core::rect<s32> rect(0, 0, 180, 240);
rect = rect + v2s32(size.X/2 + 90, size.Y/2-rect.getHeight()/2); rect = rect + v2s32(size.X/2 + 90, size.Y/2-rect.getHeight()/2);
const wchar_t *text = Environment->addStaticText(chartowchar_t(gettext(
L"Keys:\n" "Keys:\n"
L"- WASD: Walk\n" "- WASD: Walk\n"
L"- Mouse left: dig blocks\n" "- Mouse left: dig blocks\n"
L"- Mouse right: place blocks\n" "- Mouse right: place blocks\n"
L"- Mouse wheel: select item\n" "- Mouse wheel: select item\n"
L"- 0...9: select item\n" "- 0...9: select item\n"
L"- Shift: sneak\n" "- Shift: sneak\n"
L"- R: Toggle viewing all loaded chunks\n" "- R: Toggle viewing all loaded chunks\n"
L"- I: Inventory menu\n" "- I: Inventory menu\n"
L"- ESC: This menu\n" "- ESC: This menu\n"
L"- T: Chat\n"; "- T: Chat\n"
Environment->addStaticText(text, rect, false, true, this, 258); )), rect, false, true, this, 258);
} }
{ {
core::rect<s32> rect(0, 0, 180, 220); core::rect<s32> rect(0, 0, 180, 220);

View File

@ -22,6 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serialization.h" #include "serialization.h"
#include <string> #include <string>
#include "gettext.h"
GUITextInputMenu::GUITextInputMenu(gui::IGUIEnvironment* env, GUITextInputMenu::GUITextInputMenu(gui::IGUIEnvironment* env,
gui::IGUIElement* parent, s32 id, gui::IGUIElement* parent, s32 id,
IMenuManager *menumgr, IMenuManager *menumgr,
@ -105,7 +107,7 @@ void GUITextInputMenu::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 140, 30); core::rect<s32> rect(0, 0, 140, 30);
rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25); rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25);
Environment->addButton(rect, this, 257, L"Proceed"); Environment->addButton(rect, this, 257, chartowchar_t(gettext("Proceed")));
} }
} }

View File

@ -401,6 +401,8 @@ Doing currently:
#include "keycode.h" #include "keycode.h"
#include "tile.h" #include "tile.h"
#include "gettext.h"
// This makes textures // This makes textures
ITextureSource *g_texturesource = NULL; ITextureSource *g_texturesource = NULL;
@ -1058,6 +1060,9 @@ int main(int argc, char *argv[])
std::locale::global(std::locale("C")); std::locale::global(std::locale("C"));
// This enables printing all characters in bitmap font // This enables printing all characters in bitmap font
setlocale(LC_CTYPE, "en_US"); setlocale(LC_CTYPE, "en_US");
setlocale(LC_ALL, "");
bindtextdomain("minetest-c55", "./../locale");
textdomain("minetest-c55");
/* /*
Parse command line Parse command line

4
updatelocales.sh Normal file
View File

@ -0,0 +1,4 @@
#! /bin/bash
xgettext -n -o minetest-c55.pot ./src/*.cpp ./src/*.h
msgmerge -U ./po/de/minetest-c55.po minetest-c55.pot
rm minetest-c55.pot