當前位置: 首頁>>代碼示例>>Python>>正文


Python translation.get_language_info方法代碼示例

本文整理匯總了Python中django.utils.translation.get_language_info方法的典型用法代碼示例。如果您正苦於以下問題:Python translation.get_language_info方法的具體用法?Python translation.get_language_info怎麽用?Python translation.get_language_info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在django.utils.translation的用法示例。


在下文中一共展示了translation.get_language_info方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: do_get_language_info

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def do_get_language_info(parser, token):
    """
    This will store the language information dictionary for the given language
    code in a context variable.

    Usage::

        {% get_language_info for LANGUAGE_CODE as l %}
        {{ l.code }}
        {{ l.name }}
        {{ l.name_local }}
        {{ l.bidi|yesno:"bi-directional,uni-directional" }}
    """
    args = token.split_contents()
    if len(args) != 5 or args[1] != 'for' or args[3] != 'as':
        raise TemplateSyntaxError("'%s' requires 'for string as variable' (got %r)" % (args[0], args[1:]))
    return GetLanguageInfoNode(parser.compile_filter(args[2]), args[4]) 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:19,代碼來源:i18n.py

示例2: do_get_language_info

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def do_get_language_info(parser, token):
    """
    This will store the language information dictionary for the given language
    code in a context variable.

    Usage::

        {% get_language_info for LANGUAGE_CODE as l %}
        {{ l.code }}
        {{ l.name }}
        {{ l.name_translated }}
        {{ l.name_local }}
        {{ l.bidi|yesno:"bi-directional,uni-directional" }}
    """
    args = token.split_contents()
    if len(args) != 5 or args[1] != 'for' or args[3] != 'as':
        raise TemplateSyntaxError("'%s' requires 'for string as variable' (got %r)" % (args[0], args[1:]))
    return GetLanguageInfoNode(parser.compile_filter(args[2]), args[4]) 
開發者ID:reBiocoder,項目名稱:bioforum,代碼行數:20,代碼來源:i18n.py

示例3: do_get_language_info

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def do_get_language_info(parser, token):
    """
    Store the language information dictionary for the given language code in a
    context variable.

    Usage::

        {% get_language_info for LANGUAGE_CODE as l %}
        {{ l.code }}
        {{ l.name }}
        {{ l.name_translated }}
        {{ l.name_local }}
        {{ l.bidi|yesno:"bi-directional,uni-directional" }}
    """
    args = token.split_contents()
    if len(args) != 5 or args[1] != 'for' or args[3] != 'as':
        raise TemplateSyntaxError("'%s' requires 'for string as variable' (got %r)" % (args[0], args[1:]))
    return GetLanguageInfoNode(parser.compile_filter(args[2]), args[4]) 
開發者ID:PacktPublishing,項目名稱:Hands-On-Application-Development-with-PyCharm,代碼行數:20,代碼來源:i18n.py

示例4: do_get_language_info

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def do_get_language_info(parser, token):
    """
    This will store the language information dictionary for the given language
    code in a context variable.

    Usage::

        {% get_language_info for LANGUAGE_CODE as l %}
        {{ l.code }}
        {{ l.name }}
        {{ l.name_local }}
        {{ l.bidi|yesno:"bi-directional,uni-directional" }}
    """
    args = token.contents.split()
    if len(args) != 5 or args[1] != 'for' or args[3] != 'as':
        raise TemplateSyntaxError("'%s' requires 'for string as variable' (got %r)" % (args[0], args[1:]))
    return GetLanguageInfoNode(args[2], args[4]) 
開發者ID:blackye,項目名稱:luscan-devel,代碼行數:19,代碼來源:i18n.py

示例5: render

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def render(self, context):
        lang_code = self.lang_code.resolve(context)
        context[self.variable] = translation.get_language_info(lang_code)
        return '' 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:6,代碼來源:i18n.py

示例6: get_language_info

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def get_language_info(self, language):
        # ``language`` is either a language code string or a sequence
        # with the language code as its first item
        if len(language[0]) > 1:
            return translation.get_language_info(language[0])
        else:
            return translation.get_language_info(str(language)) 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:9,代碼來源:i18n.py

示例7: language_name

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def language_name(lang_code):
    return translation.get_language_info(lang_code)['name'] 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:4,代碼來源:i18n.py

示例8: language_bidi

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def language_bidi(lang_code):
    return translation.get_language_info(lang_code)['bidi'] 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:4,代碼來源:i18n.py

示例9: language_name_local

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def language_name_local(lang_code):
    return translation.get_language_info(lang_code)['name_local'] 
開發者ID:reBiocoder,項目名稱:bioforum,代碼行數:4,代碼來源:i18n.py

示例10: get_language_info

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def get_language_info(language):
    # ``language`` is either a language code string or a sequence
    # with the language code as its first item
    if len(language[0]) > 1:
        return translation.get_language_info(language[0])
    else:
        return translation.get_language_info(str(language)) 
開發者ID:DMOJ,項目名稱:online-judge,代碼行數:9,代碼來源:language.py

示例11: get_language_info_list

# 需要導入模塊: from django.utils import translation [as 別名]
# 或者: from django.utils.translation import get_language_info [as 別名]
def get_language_info_list(langs):
    return [get_language_info(lang) for lang in langs] 
開發者ID:DMOJ,項目名稱:online-judge,代碼行數:4,代碼來源:language.py


注:本文中的django.utils.translation.get_language_info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。