Refs #27656 -- Removed "This will" prefix from djanog/templatetags/i18n.py docstrings.

This commit is contained in:
Tim Graham 2018-03-21 08:07:42 -04:00
parent abe6c5defe
commit ba76c3c45b
1 changed files with 27 additions and 32 deletions

View File

@ -192,8 +192,7 @@ class LanguageNode(Node):
@register.tag("get_available_languages")
def do_get_available_languages(parser, token):
"""
This will store a list of available languages
in the context.
Store a list of available languages in the context.
Usage::
@ -202,9 +201,7 @@ def do_get_available_languages(parser, token):
...
{% endfor %}
This will just pull the LANGUAGES setting from
your setting file (or the default settings) and
put it into the named variable.
This puts settings.LANGUAGES into the named variable.
"""
# token.split_contents() isn't useful here because this tag doesn't accept variable as arguments
args = token.contents.split()
@ -216,8 +213,8 @@ def do_get_available_languages(parser, token):
@register.tag("get_language_info")
def do_get_language_info(parser, token):
"""
This will store the language information dictionary for the given language
code in a context variable.
Store the language information dictionary for the given language code in a
context variable.
Usage::
@ -237,10 +234,10 @@ def do_get_language_info(parser, token):
@register.tag("get_language_info_list")
def do_get_language_info_list(parser, token):
"""
This will store a list of language information dictionaries for the given
language codes in a context variable. The language codes can be specified
either as a list of strings or a settings.LANGUAGES style list (or any
sequence of sequences whose first items are language codes).
Store a list of language information dictionaries for the given language
codes in a context variable. The language codes can be specified either as
a list of strings or a settings.LANGUAGES style list (or any sequence of
sequences whose first items are language codes).
Usage::
@ -283,15 +280,14 @@ def language_bidi(lang_code):
@register.tag("get_current_language")
def do_get_current_language(parser, token):
"""
This will store the current language in the context.
Store the current language in the context.
Usage::
{% get_current_language as language %}
This will fetch the currently active language and
put it's value into the ``language`` context
variable.
This fetches the currently active language and puts its value into the
``language`` context variable.
"""
# token.split_contents() isn't useful here because this tag doesn't accept variable as arguments
args = token.contents.split()
@ -303,15 +299,15 @@ def do_get_current_language(parser, token):
@register.tag("get_current_language_bidi")
def do_get_current_language_bidi(parser, token):
"""
This will store the current language layout in the context.
Store the current language layout in the context.
Usage::
{% get_current_language_bidi as bidi %}
This will fetch the currently active language's layout and
put it's value into the ``bidi`` context variable.
True indicates right-to-left layout, otherwise left-to-right
This fetches the currently active language's layout and puts its value into
the ``bidi`` context variable. True indicates right-to-left layout,
otherwise left-to-right.
"""
# token.split_contents() isn't useful here because this tag doesn't accept variable as arguments
args = token.contents.split()
@ -323,33 +319,32 @@ def do_get_current_language_bidi(parser, token):
@register.tag("trans")
def do_translate(parser, token):
"""
This will mark a string for translation and will
translate the string for the current language.
Mark a string for translation and translate the string for the current
language.
Usage::
{% trans "this is a test" %}
This will mark the string for translation so it will
be pulled out by mark-messages.py into the .po files
and will run the string through the translation engine.
This marks the string for translation so it will be pulled out by
makemessages into the .po files and runs the string through the translation
engine.
There is a second form::
{% trans "this is a test" noop %}
This will only mark for translation, but will return
the string unchanged. Use it when you need to store
values into forms that should be translated later on.
This marks the string for translation, but returns the string unchanged.
Use it when you need to store values into forms that should be translated
later on.
You can use variables instead of constant strings
to translate stuff you marked somewhere else::
{% trans variable %}
This will just try to translate the contents of
the variable ``variable``. Make sure that the string
in there is something that is in the .po file.
This tries to translate the contents of the variable ``variable``. Make
sure that the string in there is something that is in the .po file.
It is possible to store the translated string into a variable::
@ -417,7 +412,7 @@ def do_translate(parser, token):
@register.tag("blocktrans")
def do_block_translate(parser, token):
"""
This will translate a block of text with parameters.
Translate a block of text with parameters.
Usage::
@ -539,7 +534,7 @@ def do_block_translate(parser, token):
@register.tag
def language(parser, token):
"""
This will enable the given language just for this block.
Enable the given language just for this block.
Usage::