コード例 #1
0
def test_no_translation():
    """
    `no_translation` provides a context where only the default
    language is active.
    """
    lang = translation.get_language()
    translation.activate('pt-br')
    with no_translation():
        eq_(translation.get_language(), settings.LANGUAGE_CODE)
    eq_(translation.get_language(), 'pt-br')
    with no_translation('es'):
        eq_(translation.get_language(), 'es')
    eq_(translation.get_language(), 'pt-br')
    translation.activate(lang)
コード例 #2
0
def get_iarc_app_title(app):
    """Delocalized app name."""
    from mkt.webapps.models import Webapp

    with no_translation(app.default_locale):
        delocalized_app = Webapp.with_deleted.get(pk=app.pk)

    return unicode(delocalized_app.name)
コード例 #3
0
ファイル: utils.py プロジェクト: Joergen/zamboni
def get_iarc_app_title(app):
    """Delocalized app name."""
    from mkt.webapps.models import Webapp

    with no_translation(app.default_locale):
        delocalized_app = Webapp.with_deleted.get(pk=app.pk)

    return unicode(delocalized_app.name)
コード例 #4
0
ファイル: client.py プロジェクト: waseem18/zamboni
def app_data(app):
    """App data that IARC needs in PushCert response / AttachToCert request."""
    author = app.listed_authors[0] if app.listed_authors else UserProfile()
    with no_translation(app.default_locale):
        app_name = unicode(Webapp.with_deleted.get(pk=app.pk).name)
    data = {
        'Publish': app.is_public(),
        'ProductName': app_name,
        'StoreProductID': app.guid,
        'StoreProductURL': absolutify(app.get_url_path()),
        # We want an identifier that does not change when users attached to
        # an app are shuffled around, so just use the app PK as developer id.
        'StoreDeveloperID': app.pk,
        # PushCert and AttachToCert docs use a different property for the
        # developer email address, use both just in case.
        'DeveloperEmail': author.email,
        'EmailAddress': author.email,
        'CompanyName': app.developer_name,
    }
    return data
コード例 #5
0
 def get_device_types(self, app):
     with no_translation():
         return [n.api_name for n in app.device_types]
コード例 #6
0
ファイル: serializers.py プロジェクト: Hitechverma/zamboni
 def get_device_types(self, app):
     with no_translation():
         return [n.api_name for n in app.device_types]
コード例 #7
0
ファイル: models.py プロジェクト: clouserw/zamboni
 def device_names(self):
     device_ids = self.devices or []
     with no_translation():
         return [DEVICE_TYPES[d].api_name for d in device_ids]