diff options
author | xhe <xw897002528@gmail.com> | 2017-11-06 23:14:44 +0800 |
---|---|---|
committer | xhe <xw897002528@gmail.com> | 2017-11-06 23:25:47 +0800 |
commit | f76fac76ac75f62537741c9fb0843b84a32f061c (patch) | |
tree | 245e7336d9cd46a9d944809c6ebd1b71918380cb | |
parent | 492ba8458b8d95de0a2d731c6e14ce23efad41db (diff) | |
download | gettext-tiny-f76fac76ac75f62537741c9fb0843b84a32f061c.tar.gz |
msgfmt: stub implementation for catalog generation
https://github.com/sabotage-linux/gettext-tiny/issues/16
Generally speaking, `-l XX -d po --language` is passed to msgfmt to
generate catalog, only one standalone parameter does not make sense. As catalog has been replaced by gettext, we just
stub it.
Here're the changes to stub these three arguments:
1. -l is followed by a language idetifier, and for -d, it's followed by
a directory, which is used to place the generated catalog files.
2. When passed `--language`, like `msgfmt --tcl...`, we cant specific
-o at the same time. Gnu error: `msgfmt: --tcl and --output-file are mutually exclusive
.` That means there should be no output on terminal but that `-d` despite the input file.
Dont check if they're passed at the same time, as the case using `--language` is very
rare, no translators are using it, but autobuild scripts, scripts only
pass the correct combination.
-rw-r--r-- | src/msgfmt.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/msgfmt.c b/src/msgfmt.c index d9db752..fbe0532 100644 --- a/src/msgfmt.c +++ b/src/msgfmt.c @@ -521,7 +521,10 @@ int main(int argc, char**argv) { streq(A+2, "csharp") || streq(A+2, "csharp-resources") || streq(A+2, "tcl") || - streq(A+2, "qt") || + streq(A+2, "qt") + ){ + set_file(1, "/dev/null", &out); + } else if( streq(A+2, "strict") || streq(A+2, "properties-input") || streq(A+2, "stringtable-input") || @@ -538,7 +541,6 @@ int main(int argc, char**argv) { strstarts(A+2, "check-accelerators=") || strstarts(A+2, "resource=") || strstarts(A+2, "locale=") - ) { } else if((dest = strstarts(A+2, "output-file="))) { set_file(1, dest, &out); @@ -553,7 +555,6 @@ int main(int argc, char**argv) { } else if( streq(A+1, "j") || streq(A+1, "r") || - streq(A+1, "l") || streq(A+1, "P") || streq(A+1, "f") || streq(A+1, "a") || @@ -563,12 +564,10 @@ int main(int argc, char**argv) { ) { } else if (streq(A+1, "V")) { version(); - } else if (streq(A+1, "d")) { - // no support for -d at this time - fprintf(stderr, "EINVAL\n"); - exit(1); } else if (streq(A+1, "h")) { syntax(); + } else if (streq(A+1, "l") || streq(A+1, "d")) { + arg++; } else if (expect_in_fn) { set_file(0, A, &in); expect_in_fn = 0; |