当前位置: 首页>>代码示例>>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;未经允许,请勿转载。