當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。