本文整理匯總了Python中django.views.i18n.javascript_catalog方法的典型用法代碼示例。如果您正苦於以下問題:Python i18n.javascript_catalog方法的具體用法?Python i18n.javascript_catalog怎麽用?Python i18n.javascript_catalog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.views.i18n
的用法示例。
在下文中一共展示了i18n.javascript_catalog方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: i18n_javascript
# 需要導入模塊: from django.views import i18n [as 別名]
# 或者: from django.views.i18n import javascript_catalog [as 別名]
def i18n_javascript(self, request):
"""
Displays the i18n JavaScript that the Django admin requires.
This takes into account the USE_I18N setting. If it's set to False, the
generated JavaScript will be leaner and faster.
"""
if settings.USE_I18N:
from django.views.i18n import javascript_catalog
else:
from django.views.i18n import null_javascript_catalog as javascript_catalog
return javascript_catalog(request, packages=['django.conf', 'xadmin'])
# This global object represents the default admin site, for the common case.
# You can instantiate AdminSite in your own code to create a custom admin site.
示例2: i18n_javascript
# 需要導入模塊: from django.views import i18n [as 別名]
# 或者: from django.views.i18n import javascript_catalog [as 別名]
def i18n_javascript(self, request):
"""
Displays the i18n JavaScript that the Django admin requires.
This takes into account the USE_I18N setting. If it's set to False, the
generated JavaScript will be leaner and faster.
"""
if settings.USE_I18N:
from django.views.i18n import javascript_catalog
else:
from django.views.i18n import null_javascript_catalog as javascript_catalog
return javascript_catalog(request, packages=['django.conf', 'django.contrib.admin'])
示例3: jsi18n
# 需要導入模塊: from django.views import i18n [as 別名]
# 或者: from django.views.i18n import javascript_catalog [as 別名]
def jsi18n(request):
return javascript_catalog(request, 'djangojs', ['userlog'])
示例4: cached_javascript_catalog
# 需要導入模塊: from django.views import i18n [as 別名]
# 或者: from django.views.i18n import javascript_catalog [as 別名]
def cached_javascript_catalog(request, domain='djangojs', packages=None):
"""
https://docs.djangoproject.com/en/1.5/topics/i18n/translation/#note-on-performance
"""
return javascript_catalog(request, domain, packages)