Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
ba76c3c4
Kaydet (Commit)
ba76c3c4
authored
Mar 21, 2018
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #27656 -- Removed "This will" prefix from djanog/templatetags/i18n.py docstrings.
üst
abe6c5de
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
32 deletions
+27
-32
i18n.py
django/templatetags/i18n.py
+27
-32
No files found.
django/templatetags/i18n.py
Dosyayı görüntüle @
ba76c3c4
...
@@ -192,8 +192,7 @@ class LanguageNode(Node):
...
@@ -192,8 +192,7 @@ class LanguageNode(Node):
@register.tag
(
"get_available_languages"
)
@register.tag
(
"get_available_languages"
)
def
do_get_available_languages
(
parser
,
token
):
def
do_get_available_languages
(
parser
,
token
):
"""
"""
This will store a list of available languages
Store a list of available languages in the context.
in the context.
Usage::
Usage::
...
@@ -202,9 +201,7 @@ def do_get_available_languages(parser, token):
...
@@ -202,9 +201,7 @@ def do_get_available_languages(parser, token):
...
...
{
%
endfor
%
}
{
%
endfor
%
}
This will just pull the LANGUAGES setting from
This puts settings.LANGUAGES into the named variable.
your setting file (or the default settings) and
put it into the named variable.
"""
"""
# token.split_contents() isn't useful here because this tag doesn't accept variable as arguments
# token.split_contents() isn't useful here because this tag doesn't accept variable as arguments
args
=
token
.
contents
.
split
()
args
=
token
.
contents
.
split
()
...
@@ -216,8 +213,8 @@ def do_get_available_languages(parser, token):
...
@@ -216,8 +213,8 @@ def do_get_available_languages(parser, token):
@register.tag
(
"get_language_info"
)
@register.tag
(
"get_language_info"
)
def
do_get_language_info
(
parser
,
token
):
def
do_get_language_info
(
parser
,
token
):
"""
"""
This will store the language information dictionary for the given language
Store the language information dictionary for the given language code in a
co
de in a co
ntext variable.
context variable.
Usage::
Usage::
...
@@ -237,10 +234,10 @@ def do_get_language_info(parser, token):
...
@@ -237,10 +234,10 @@ def do_get_language_info(parser, token):
@register.tag
(
"get_language_info_list"
)
@register.tag
(
"get_language_info_list"
)
def
do_get_language_info_list
(
parser
,
token
):
def
do_get_language_info_list
(
parser
,
token
):
"""
"""
This will store a list of language information dictionaries for the given
Store a list of language information dictionaries for the given language
language codes in a context variable. The language codes can be specified
codes in a context variable. The language codes can be specified either as
either as a list of strings or a settings.LANGUAGES style list (or any
a list of strings or a settings.LANGUAGES style list (or any sequence of
sequence
of sequence
s whose first items are language codes).
sequences whose first items are language codes).
Usage::
Usage::
...
@@ -283,15 +280,14 @@ def language_bidi(lang_code):
...
@@ -283,15 +280,14 @@ def language_bidi(lang_code):
@register.tag
(
"get_current_language"
)
@register.tag
(
"get_current_language"
)
def
do_get_current_language
(
parser
,
token
):
def
do_get_current_language
(
parser
,
token
):
"""
"""
This will s
tore the current language in the context.
S
tore the current language in the context.
Usage::
Usage::
{
%
get_current_language as language
%
}
{
%
get_current_language as language
%
}
This will fetch the currently active language and
This fetches the currently active language and puts its value into the
put it's value into the ``language`` context
``language`` context variable.
variable.
"""
"""
# token.split_contents() isn't useful here because this tag doesn't accept variable as arguments
# token.split_contents() isn't useful here because this tag doesn't accept variable as arguments
args
=
token
.
contents
.
split
()
args
=
token
.
contents
.
split
()
...
@@ -303,15 +299,15 @@ def do_get_current_language(parser, token):
...
@@ -303,15 +299,15 @@ def do_get_current_language(parser, token):
@register.tag
(
"get_current_language_bidi"
)
@register.tag
(
"get_current_language_bidi"
)
def
do_get_current_language_bidi
(
parser
,
token
):
def
do_get_current_language_bidi
(
parser
,
token
):
"""
"""
This will s
tore the current language layout in the context.
S
tore the current language layout in the context.
Usage::
Usage::
{
%
get_current_language_bidi as bidi
%
}
{
%
get_current_language_bidi as bidi
%
}
This
will fetch the currently active language's layout and
This
fetches the currently active language's layout and puts its value into
put it's value into the ``bidi`` context variable.
the ``bidi`` context variable. True indicates right-to-left layout,
True indicates right-to-left layout, otherwise left-to-right
otherwise left-to-right.
"""
"""
# token.split_contents() isn't useful here because this tag doesn't accept variable as arguments
# token.split_contents() isn't useful here because this tag doesn't accept variable as arguments
args
=
token
.
contents
.
split
()
args
=
token
.
contents
.
split
()
...
@@ -323,33 +319,32 @@ def do_get_current_language_bidi(parser, token):
...
@@ -323,33 +319,32 @@ def do_get_current_language_bidi(parser, token):
@register.tag
(
"trans"
)
@register.tag
(
"trans"
)
def
do_translate
(
parser
,
token
):
def
do_translate
(
parser
,
token
):
"""
"""
This will mark a string for translation and will
Mark a string for translation and translate the string for the current
translate the string for the current
language.
language.
Usage::
Usage::
{
%
trans "this is a test"
%
}
{
%
trans "this is a test"
%
}
This
will mark the string for translation so it will
This
marks the string for translation so it will be pulled out by
be pulled out by mark-messages.py into the .po files
makemessages into the .po files and runs the string through the translation
and will run the string through the translation
engine.
engine.
There is a second form::
There is a second form::
{
%
trans "this is a test" noop
%
}
{
%
trans "this is a test" noop
%
}
This
will only mark for translation, but will return
This
marks the string for translation, but returns the string unchanged.
the string unchanged. Use it when you need to store
Use it when you need to store values into forms that should be translated
values into forms that should be translated
later on.
later on.
You can use variables instead of constant strings
You can use variables instead of constant strings
to translate stuff you marked somewhere else::
to translate stuff you marked somewhere else::
{
%
trans variable
%
}
{
%
trans variable
%
}
This will just try to translate the contents of
This tries to translate the contents of the variable ``variable``. Make
the variable ``variable``. Make sure that the string
sure that the string in there is something that is in the .po file.
in there is something that is in the .po file.
It is possible to store the translated string into a variable::
It is possible to store the translated string into a variable::
...
@@ -417,7 +412,7 @@ def do_translate(parser, token):
...
@@ -417,7 +412,7 @@ def do_translate(parser, token):
@register.tag
(
"blocktrans"
)
@register.tag
(
"blocktrans"
)
def
do_block_translate
(
parser
,
token
):
def
do_block_translate
(
parser
,
token
):
"""
"""
T
his will t
ranslate a block of text with parameters.
Translate a block of text with parameters.
Usage::
Usage::
...
@@ -539,7 +534,7 @@ def do_block_translate(parser, token):
...
@@ -539,7 +534,7 @@ def do_block_translate(parser, token):
@register.tag
@register.tag
def
language
(
parser
,
token
):
def
language
(
parser
,
token
):
"""
"""
This will e
nable the given language just for this block.
E
nable the given language just for this block.
Usage::
Usage::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment