【问题标题】:msginit email address command line argument?msginit 电子邮件地址命令行参数?
【发布时间】:2009-06-20 16:49:23
【问题描述】:

msginit 提示输入电子邮件地址。有没有办法告诉 msginit 使用哪个电子邮件地址而无需提示输入,例如命令行参数?

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;
}
EOF
g++ -ohellogt hellogt.cxx
xgettext -d hellogt -o hellogt.pot hellogt.cxx
msginit -l es_MX -o spanish.po -i hellogt.pot

【问题讨论】:

  • 引用 JS:“反对者:请提供 cmets。- Jon Skeet 5 月 8 日 9:25”

标签: linux internationalization gettext


【解决方案1】:

您的问题是由于msginit 使用/usr/lib64/gettext/user-email 来提示您输入电子邮件。如果您改为使用--no-translator 选项运行msginit,它应该假定它是以非交互方式运行并且不会提示您:

msginit --no-translator -l es_MX -o spanish.po -i hellogt.pot

【讨论】:

  • 我将/usr/lib64/gettext/user-email 改写为echo &lt;my email address&gt;。这也是一个(更激进的)解决方案。
  • 您还可以创建包含行set from=you@example.com 的文件~/.muttrc。但是 msginit 仍然会提示您是否要使用:1)you@example.com,或 2)you@localhostname
猜你喜欢
  • 2023-03-03
  • 2017-08-05
  • 2017-07-23
  • 2010-11-20
  • 1970-01-01
  • 2012-04-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多