translated main menu to german, omitting header info in gettext calls, libs, test gettext call in menuitem render

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4629 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2009-08-12 20:58:29 +00:00
parent e7a3cc012b
commit 581ecdb9f6
15 changed files with 141 additions and 2 deletions
+1
View File
@@ -9,6 +9,7 @@
#include "weapon.h"
#include "entity.h"
#include "world.h"
#include "i18n.h"
#ifndef STANDALONE
#include "command.h"
+15
View File
@@ -0,0 +1,15 @@
// internationalization and localization
#include "pch.h"
#include "cube.h"
i18nmanager::i18nmanager(const char *domain, const char *basepath) : domain(domain), basepath(basepath)
{
locale = setlocale(LC_ALL, ""); // use current default locale
bindtextdomain(domain, basepath); // set base path
textdomain(domain);
printf("current locale: %s\n", locale);
printf(_("hello world\n")); // test output
}
+12
View File
@@ -0,0 +1,12 @@
// internationalization and localization
// localization manager
struct i18nmanager
{
const char *basepath;
const char *domain;
char *locale;
i18nmanager(const char *domain, const char *basepath); // initialize locale system
};
+2
View File
@@ -606,6 +606,8 @@ int main(int argc, char **argv)
}
if(!quitdirectly)
{
i18nmanager i18n("AC", path("packages/locale", true));
initing = NOT_INITING;
initlog("sdl");
+1 -1
View File
@@ -158,7 +158,7 @@ struct mitemmanual : mitem
virtual void render(int x, int y, int w)
{
mitem::render(x, y, w);
draw_text(text, x, y);
draw_text(_(text), x, y);
}
virtual void focus(bool on)
+9 -1
View File
@@ -638,7 +638,15 @@ inline char *newstring(const char *s) { return newstring(s, strlen(s))
inline char *newstringbuf() { return newstring(_MAXDEFSTR-1); }
inline char *newstringbuf(const char *s) { return newstring(s, _MAXDEFSTR-1); }
#define _(STRING) gettext(STRING)
inline char *_gettext(const char *msgid)
{
if(msgid && msgid[0] != '\0')
return gettext(msgid);
else
return "";
}
#define _(s) _gettext(s)
extern const char *timestring(bool local = false, const char *fmt = NULL);
extern const char *asctime();