문제

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"
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top