Question

msginit prompts for an email address. Is there a way to tell msginit what email address to use without being prompted for it such as a command line argument?

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
Was it helpful?

Solution

Your problem is due to msginit using /usr/lib64/gettext/user-email to prompt for your email. If you instead run msginit with the --no-translator option it should assume it's being run non-interactively and not prompt you:

msginit --no-translator -l es_MX -o spanish.po -i hellogt.pot
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top