当前位置: 首页>>代码示例>>Python>>正文


Python translation.gettext_noop方法代码示例

本文整理汇总了Python中django.utils.translation.gettext_noop方法的典型用法代码示例。如果您正苦于以下问题:Python translation.gettext_noop方法的具体用法?Python translation.gettext_noop怎么用?Python translation.gettext_noop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.utils.translation的用法示例。


在下文中一共展示了translation.gettext_noop方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: safe_summary

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import gettext_noop [as 别名]
def safe_summary(self, encoded):
        algorithm, iterations, salt, hash = encoded.split('$', 3)
        assert algorithm == self.algorithm
        return OrderedDict([
            (_('algorithm'), algorithm),
            (_('iterations'), iterations),
            (_('salt'), mask_hash(salt)),
            (_('hash'), mask_hash(hash)),
        ]) 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:11,代码来源:hashers.py

示例2: harden_runtime

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import gettext_noop [as 别名]
def harden_runtime(self, password, encoded):
        _, data = encoded.split('$', 1)
        salt = data[:29]  # Length of the salt in bcrypt.
        rounds = data.split('$')[2]
        # work factor is logarithmic, adding one doubles the load.
        diff = 2**(self.rounds - int(rounds)) - 1
        while diff > 0:
            self.encode(password, force_bytes(salt))
            diff -= 1 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:11,代码来源:hashers.py

示例3: _get_result_data

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import gettext_noop [as 别名]
def _get_result_data(results):
    return {
        'categories': [
            # Using gettext_noop here since this will be tacked into the cache, so it must be language neutral.
            # The caller, SubmissionList.get_result_data will run ugettext on the name.
            {'code': 'AC', 'name': gettext_noop('Accepted'), 'count': results['AC']},
            {'code': 'WA', 'name': gettext_noop('Wrong'), 'count': results['WA']},
            {'code': 'CE', 'name': gettext_noop('Compile Error'), 'count': results['CE']},
            {'code': 'TLE', 'name': gettext_noop('Timeout'), 'count': results['TLE']},
            {'code': 'ERR', 'name': gettext_noop('Error'),
             'count': results['MLE'] + results['OLE'] + results['IR'] + results['RTE'] + results['AB'] + results['IE']},
        ],
        'total': sum(results.values()),
    } 
开发者ID:DMOJ,项目名称:online-judge,代码行数:16,代码来源:problems.py

示例4: create_pootle_permissions

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import gettext_noop [as 别名]
def create_pootle_permissions(self):
        """Create Pootle's directory level permissions."""

        args = {
            "app_label": "pootle_app",
            "model": "directory",
        }

        pootle_content_type = self._create_object(ContentType, **args)[0]
        pootle_content_type.save()

        # Create the permissions.
        permissions = [
            {"name": _("Can access a project"), "codename": "view"},
            {"name": _("Cannot access a project"), "codename": "hide"},
            {
                "name": _("Can make a suggestion for a translation"),
                "codename": "suggest",
            },
            {"name": _("Can submit a translation"), "codename": "translate"},
            {"name": _("Can review suggestions"), "codename": "review"},
            {
                "name": _("Can perform administrative tasks"),
                "codename": "administrate",
            },
        ]

        criteria = {
            "content_type": pootle_content_type,
        }

        for permission in permissions:
            criteria.update(permission)
            self._create_object(Permission, **criteria) 
开发者ID:evernote,项目名称:zing,代码行数:36,代码来源:initdb.py

示例5: harden_runtime

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import gettext_noop [as 别名]
def harden_runtime(self, password, encoded):
        _, data = encoded.split('$', 1)
        salt = data[:29]  # Length of the salt in bcrypt.
        rounds = data.split('$')[2]
        # work factor is logarithmic, adding one doubles the load.
        diff = 2**(self.rounds - int(rounds)) - 1
        while diff > 0:
            self.encode(password, salt.encode('ascii'))
            diff -= 1 
开发者ID:PacktPublishing,项目名称:Hands-On-Application-Development-with-PyCharm,代码行数:11,代码来源:hashers.py

示例6: test_from_gettext

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import gettext_noop [as 别名]
def test_from_gettext():
    gstr = gettext_noop('Welcome')
    lstr = LazyI18nString.from_gettext(gstr)
    assert 'de' in lstr.data
    assert lstr.data['en'] == 'Welcome' 
开发者ID:raphaelm,项目名称:django-i18nfield,代码行数:7,代码来源:test_strings.py

示例7: handle

# 需要导入模块: from django.utils import translation [as 别名]
# 或者: from django.utils.translation import gettext_noop [as 别名]
def handle(self, *args, **options):
        NoticeType.create(
            "create_meeting_slot",
            _("Periodo de reunion creada"),
            _("tu periodo de reunion esta lista"),
        )

        NoticeType.create(
            "reserved_meeting_slot",
            _("Reunion aceptada"),
            _("tu reunion ha sido aceptada"),
        )

        NoticeType.create(
            "cancelled_by_mentor",
            _("Reunion cancelada por el mentor"),
            _("tu reunion ha sido cancelada"),
        )

        NoticeType.create(
            "cancelled_by_protege",
            _("Reunion cacelada por aprendiz"),
            _("your meeting has been cancelled"),
        )

        NoticeType.create(
            "confirmed_meeting",
            _("Reunion confirmada"),
            _("su reunion ha sido confirmada"),
        )

        NoticeType.create(
            "post_meeting_mentor", _("Dejenos saber"), _("como le fue en su reunion?")
        )

        NoticeType.create(
            "post_meeting_protege", _("Dejenos saber"), _("como le fue en su reunion?")
        )

        NoticeType.create(
            "comment", _("Comentario nuevo"), _("tienes un nuevo comentario")
        )

        self.stdout.write("--> Created notice types") 
开发者ID:SoPR,项目名称:horas,代码行数:46,代码来源:create_notice_types.py


注:本文中的django.utils.translation.gettext_noop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。