Domanda

Can someone tell me if this is the correct approach for localizing my Python strings? It works great but I cannot find anywhere whether or not this is exactly how I should be doing it. Many thanks!!!

In my Python script, I have taken following string formatting approach:

print(_('{0} does not exist').format(file_name))

My message.pot file contains this:

#: some_file.py:65
#, python-format
msgid "{0} does not exist"
msgstr ""

My translated file (messages_fr.po) is like this:

#: some_file.py:65
#, python-format
msgid "{0} does not exist"
msgstr "{0} n'existe pas"
È stato utile?

Soluzione

That is exactly how L10N should be performed on simple strings. Note that the filename of the message catalog will depend on how exactly I18N was performed.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top