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.
Is this a valid Python string formatting technique for localization?
-
18-07-2023 - |
Question
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"
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow