Translation with variables
Daniel
xracoonx at gmx.de
Tue Jan 31 16:06:02 UTC 2023
On 2023-01-31 11:13, Jean-Marc Lasgouttes wrote:
> Le 31/01/2023 à 11:02, Daniel a écrit :
>> How do I make a string with a variable translatable?
>>
>> Say in English I have
>>
>> "Press " + X + " to find."
>>
>> But for a translation to other languages it might not be sufficient to
>> translate "Press " and " to find." and string them together in the
>> same way as in English. So, maybe it is not sufficient to do:
>>
>> _("Press ") + X + _(" to find.")
>>
>> Or is it up to the translator to figure this out (maybe the added
>> spaces are an indication for there being a particular context)?
>
> Use bformat(). Random example:
> docstring s = bformat(_("The document class `%1$s' "
> "could not be loaded."), from_utf8(argument));
>
> JMarc
Thanks!
Daniel
More information about the lyx-devel
mailing list