关于这个问题:
I know what gettext is. I’ve read a few posts where they mentioned xgettext and was curious as to what is the difference between the two.
简而言之,gettext()是一个函数,xgettext是一个用于从源代码中提取消息的实用程序.
gettext("hello, world!")
gettext()函数传递一个文本字符串,该文本字符串用作运行时使用的消息的索引.它返回在代码中或在调用程序时指定的语言的指定消息.
然后它显示:
xgettext --package-name hellogt --package-version 1.2 --default-domain hellogt --output hellogt.pot hellogt.cxx
这是在构建时使用的实用程序,用于检查传递给gettext()的文本字符串的源代码文件hellogt.cxx.这些被提取并用于创建便携式对象模板文件hellogt.pot.
翻译者在运行时通过gettext()传递二进制翻译的消息文件hellogt.mo的过程中使用.pot文件模板.