> On 17 Aug 2023, at 15:01, c.buhtz--- via Python-list <python-list@python.org> 
> wrote:
> 
> I want to display one string in its original source (untranslated) version 
> and in its translated version site by site without duplicating the string in 
> the python source code?
> It wouldn't be a big deal if it is only one word.

The key to solving this to separate the parsing of the string into the .po file 
and its translation.

def i18n(s):
      return s

msg = i18n(‘my message’)

print(_(msg))
print(msg)

Now you tell the xgettex, pygettext etc, to parse to use “i18n” to find strings 
to translate.

This is covered in the docs at 
https://docs.python.org/3/library/gettext.html#localizing-your-module

Barry





-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to