Re: [PATCH] Support generate poison .mo files for testing
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Aug 23, 2012, 11:00 UTC
- Message-ID
- <CACsJy8Ak0iR9WytPys1uy=M52TVh+0y4DWrv63Efvie4nsRORA@mail.gmail.com>
- In-Reply-To
- <7vtxvuand1.fsf@alter.siamese.dyndns.org>
On Wed, Aug 22, 2012 at 11:43 PM, Junio C Hamano <gitster@pobox.com> wrote:
> why are you special casing a run of non-blank letters that begin > with a dollar sign (swapping two ints is done with "%2$d %1$d", a > percent still at the beginning, so there must be something else I am > missing)?
'$' is for shell variables. I should separate it from C messages. All these because now that we run the (fake) translation through gettext toolchain, it'll catch us if we don't preserve dynamic parts correctly.
> Also why do you stop at isspace()? Isn't a " " (space) a flag that > means "If the first character of a signed conversion is not a sign > or if a signed conversion results in no characters, a <space> shall > be prefixed to the result."
A hurry attempt to get past msgfmt. I should refine these code, either by...
Show 29 quoted lines
> As the flags, min-width, precision, and length do not share the same
> character as the conversion that has to come at the end, I think you
> only want to do something like
>
> /*
> * conversion specifier characters, taken from:
> * http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html
> */
> static const char printf_conversion[] = "diouxXfFeEgGaAcspnCS%";
>
> ...
>
> while (msg < end) {
> if (*msg == '%') {
> strbuf_addch(buf, *msg++);
> while (msg < end) {
> int ch = *msg++;
> strbuf_addch(buf, ch);
> if (strchr(printf_conversion, ch))
> break;
> }
> /* copied the printf part literally */
> continue;
> }
> ... keep \n ...
> ... muck with string ...
> }
>
> perhaps?following this, or copying the matching logic from msgfmt source.
-- Duy