This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gettext support for GCC 4.0 internal format, fix for PR translation/21364


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]