本文整理匯總了Python中django.utils.translation.trans_real._default方法的典型用法代碼示例。如果您正苦於以下問題:Python trans_real._default方法的具體用法?Python trans_real._default怎麽用?Python trans_real._default使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.utils.translation.trans_real
的用法示例。
在下文中一共展示了trans_real._default方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: reset_translations
# 需要導入模塊: from django.utils.translation import trans_real [as 別名]
# 或者: from django.utils.translation.trans_real import _default [as 別名]
def reset_translations():
import gettext
from django.utils.translation import trans_real
gettext._translations = {}
trans_real._translations = {}
trans_real._default = None
trans_real._active = threading.local()
示例2: language_changed
# 需要導入模塊: from django.utils.translation import trans_real [as 別名]
# 或者: from django.utils.translation.trans_real import _default [as 別名]
def language_changed(**kwargs):
if kwargs['setting'] in {'LANGUAGES', 'LANGUAGE_CODE', 'LOCALE_PATHS'}:
from django.utils.translation import trans_real
trans_real._default = None
trans_real._active = threading.local()
if kwargs['setting'] in {'LANGUAGES', 'LOCALE_PATHS'}:
from django.utils.translation import trans_real
trans_real._translations = {}
trans_real.check_for_language.cache_clear()
示例3: language_changed
# 需要導入模塊: from django.utils.translation import trans_real [as 別名]
# 或者: from django.utils.translation.trans_real import _default [as 別名]
def language_changed(**kwargs):
if kwargs['setting'] in ('LOCALE_PATHS', 'LANGUAGE_CODE'):
from django.utils.translation import trans_real
trans_real._default = None
if kwargs['setting'] == 'LOCALE_PATHS':
trans_real._translations = {}
示例4: test_resets_trans_real
# 需要導入模塊: from django.utils.translation import trans_real [as 別名]
# 或者: from django.utils.translation.trans_real import _default [as 別名]
def test_resets_trans_real(self):
trans_real._translations = {'foo': 'bar'}
trans_real._default = 1
trans_real._active = False
autoreload.reset_translations()
self.assertEqual(trans_real._translations, {})
self.assertIsNone(trans_real._default)
self.assertIsInstance(trans_real._active, _thread._local)