Re: [PATCH 2/2] i18n: Add extra -- to seperate gettext and message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2012/6/5 Junio C Hamano <gitster@xxxxxxxxx>:
> I think there is value for having a generic solution than declaring
> "No message shall begin with a dash".
>
> I am not convinced that it is ideal for the implementation of
> gettext_ln to prepend "--" in front when it calls gettext, though.

I saw Ævar's bug report on xgettext to the GNU gettext list:

 * http://git.661346.n2.nabble.com/GETTEXT-BUG-xgettext-1-can-t-extract-quot-gettext-foo-quot-td7560744.html

May be post to a more official mailing list, such as bug-gnu-utils at
https://lists.gnu.org/mailman/listinfo/bug-gnu-utils will get some response,
but I doubt there won't be a clear resolution in xgettext.

The default configurations of xgettext for shell scripts are defined in file
'gettext-tools/src/x-sh.c':

      x_sh_keyword ("gettext");
      x_sh_keyword ("ngettext:1,2");
      x_sh_keyword ("eval_gettext");
      x_sh_keyword ("eval_ngettext:1,2");

Keyword "gettext" above is the same as "gettext:1". xgettext has
no idea of options and arguments, if there is a seperator ('--') between
gettext and the message, message is argument 2. For example:

    gettext -- "--cached cannot be used with --files"

We can override the default settings of xgettext by passing '-k' and
multiple '--keyword', '--flags' options to xgettext.

    xgettext  ... --language=Shell \
                  -k  --keyword=gettext:2 \
                  --flag=gettext:2:pass-sh-format  ...

But "gettext message" will be broken.

Write a wrapper for gettext  and extract messages using
'xgettext --keyword=<gettext-wrapper>' is a reasonable solution.


-- 
Jiang Xin
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]