本文整理汇总了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)