cat >hellogt.cxx <<EOF// hellogt.cxx#include <libintl.h>#include <locale.h>#include <iostream>int main (){ setlocale(LC_ALL, ""); bindtextdomain("hellogt", "."); textdomain( "hellogt"); std::cout << gettext("hello, world!") << std::endl;}EOFg++ -o hellogt hellogt.cxxxgettext --package-name hellogt --package-version 1.2 --default-domain hellogt --output hellogt.pot hellogt.cxxmsginit --no-translator --locale es_MX --output-file hellogt_spanish.po --input hellogt.potsed --in-place hellogt_spanish.po --expression='/"hello, world!"/,/#: / s/""/"hola mundo"/'mkdir --parents ./es_MX.utf8/LC_MESSAGESmsgfmt --check --verbose --output-file ./es_MX.utf8/LC_MESSAGES/hellogt.mo hellogt_spanish.poLANGUAGE=es_MX.utf8 ./hellogt这是上面创建的文件的描述:
hellogt.cxx C++ source filehellogt Executable imagehellogt.pot Extracted text from C++ source file (portable object template)hellogt_spanish.po Modified text for Spanish with translations added (using sed)es_MX.utf8/ LC_MESSAGES/ hellogt.mo Binary translated text for Spanish used at run-time



