This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] gettext support for GCC 4.0 internal format, fix for PR translation/21364
- From: Bruno Haible <bruno at clisp dot org>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, gcc-patches at gcc dot gnu dot org, translation at iro dot umontreal dot ca
- Date: Tue, 31 May 2005 19:21:29 +0200
- Subject: Re: [PATCH] gettext support for GCC 4.0 internal format, fix for PR translation/21364
- References: <20050517113757.GD4930@devserv.devel.redhat.com> <200505301854.31245.bruno@clisp.org> <20050531135834.GI22349@devserv.devel.redhat.com>
Jakub Jelinek wrote:
> xgettext test.c --language=GCC-source --keyword=error --keyword=warning:2 \
> --keyword=fnotice:2 --keyword=_ --flag=error:1:gcc-internal-format \
> --flag=warning:2:gcc-internal-format --flag=fnotice:2:c-format
>
> doesn't do this, it will mark error and warning string literals
> as gcc-internal-format, but not mark "%g\n" as c-format.
Indeed. That's a bug.
As a workaround, you can use two xgettext invocations: one which will
provide the gcc-internal-format annotations, and one which will
provide the c-format ones. Merging the two (via xgettext again) will
combine the annotations.
Like this. (I also added --flag=_:1:pass-... options for _().)
COMMON_FLAGS="--keyword=error --keyword=warning:2 --keyword=fnotice:2 --keyword=_"
C_FLAGS="--flag=fnotice:2:c-format --flag=_:1:pass-c-format"
GCCINTERNAL_FLAGS="--flag=error:1:gcc-internal-format --flag=warning:2:gcc-internal-format --flag=_:1:pass-gcc-internal-format"
xgettext test.c --language=c $COMMON_FLAGS $C_FLAGS -o pot1
xgettext test.c --language=GCC-source $COMMON_FLAGS $GCCINTERNAL_FLAGS -o pot2
xgettext --language=PO pot1 pot2 -o final.pot
> Will other tools handle mixed message types?
Yes, msgmerge, msgcat and all other tools handle PO files with any combination
of the annotations. (It's needed because the same string might occur in a
C program and in a sh script.)
The intended use of 'cmsgid' and 'gmsgid' vs. 'msgid' looks alright to me.
Bruno