2
我会尝试使用gnu-gettext来进行半大型软件项目的本地化,所以现在我正在尝试学习基础知识。问题是我陷入了一个非常基本的功能。当我尝试使用xgettext从源代码中提取字符串时,我什么也得不到。当DLL丢失它抱怨,并且当一个参数错误它抱怨,但现在它只是默默地返回,没有产生任何锅文件或其他任何东西。我没有从xgettext输出
所以,我的问题是: 有没有人认识到这个问题? 有什么办法可以让xgettext更加详细地介绍它在做什么?
我曾尝试将xgettext放入源文件中,并将sourcefile放入gettext \ bin目录中,但无济于事。
我应该提到我正在使用Win7机器,并使用gettext-tools-dev_0.18.1.1-2_win32。我已经安装了MinGW。
我testcode锁这样的:
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include "libintl.h"
#include "locale.h"
#include "helper.h"
#define _(String) gettext(String)
#define N_(String) String
//#define textdomain(Domain)
//#define bindtextdomain(Package, Directory)
int main(void)
{
printf("setlocale returns %s\n", setlocale(LC_ALL, ""));
bindtextdomain("hello", "locale");
textdomain("hello");
int a = 1;
int b = 2;
/// First string
printf(_("Hello, world!\n"));
std::string multiline =
/* Another string */
_("This is a " \
"multi line string.");
// A string that contains another
printf(_("A string: %s\n"), multiline.c_str());
printf(N_("An untranslatable string!\n"));
int foo = 42;
/// Playing with positions; int before string in original...
printf(_("int: %1$d, string: %2$s\n"), foo, _("Fubar"));
printf(_("%1$s %2$s\n"), Helper::String1().c_str(), Helper::String2().c_str());
exit(0);
}
如果有人可以帮助我在这,我将感谢。 /Robert