Last active
October 31, 2017 08:24
-
-
Save ewjoachim/dcb6774d3d4d1c0de7cef3518f406ddb to your computer and use it in GitHub Desktop.
Django, gettext, contexts and comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.translation import ugettext as _ | |
from django.utils.translation import pgettext | |
# _() means normal translation | |
_("Hello world") | |
# Translators: This is a comment | |
_("Hello world") | |
# Translators: This is a another comment | |
_("Hello world") | |
# pgettext() means translation with context | |
pgettext("This is a context", "Hello World") | |
pgettext("This is another context", "Hello World") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (...) | |
#. Translators: This is a comment | |
#. Translators: This is a another comment | |
#: i18nstrings/i18n.py:4 i18nstrings/i18n.py:7 i18nstrings/i18n.py:10 | |
msgid "Hello world" | |
msgstr "" | |
#: i18nstrings/i18n.py:12 | |
msgctxt "This is a context" | |
msgid "Hello World" | |
msgstr "" | |
#: i18nstrings/i18n.py:14 | |
msgctxt "This is another context" | |
msgid "Hello World" | |
msgstr "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment