bug-gettext
[Top][All Lists]
Advanced

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

Re: gettextizing an old Java application


From: Kovács Zoltán
Subject: Re: gettextizing an old Java application
Date: Tue, 14 Nov 2023 10:07:06 +0100

Thank you, Bruno, I will try to use your suggestion.
Best regards, Zoltan

Bruno Haible <bruno@clisp.org> ezt írta (időpont: 2023. nov. 13., H, 23:50):
Kovács Zoltán wrote:
> I am trying to use xgettext to create a .pot file from an existing Java
> source code. Unfortunately, the code seems to be written a bit differently
> than expected by xgettext:
>
> 1. Several calls include two msgid's, for example:
> translate("File", "The File Menu");
> where the first string is the name of the menu and the second one is its
> tooltip. In such cases I cannot get both translations at the same time
> because xgettext gives me the following error: "ambiguous argument
> specification for keyword 'translate'". Here I use the command line options
> "-ktranslate:1 -ktranslate:2". I get only the first entry "File", the other
> one is not present in the .pot file.

You could declare the first argument to be a "context" (msgctxt argument)
and the second argument to be a regular msgid.

The syntax for this is: --keyword=translate:1c,2

> 2. I tried to work this around by splitting the method translate() into two
> calls translateMenuitem() and translateTooltip() and call a final method
> translateString() separately, but seemingly there is no semantic analysis
> to find out that translateString() is called via another calls, so I get no
> output here at all.

Sure, xgettext does not do control-flow analysis of your program. With this
approach you also have to pass the options --keyword=translateMenuitem
--keyword=translateTooltip .

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]