2006-07-04 11:58:45 +08:00
|
|
|
# These are versions of the functions in django.utils.translation.trans_real
|
|
|
|
# that don't actually do anything. This is purely for performance, so that
|
|
|
|
# settings.USE_I18N = False can use this module rather than trans_real.py.
|
|
|
|
|
|
|
|
from django.conf import settings
|
2012-07-21 16:00:10 +08:00
|
|
|
from django.utils.encoding import force_text
|
2006-07-04 11:58:45 +08:00
|
|
|
|
2013-11-03 07:53:29 +08:00
|
|
|
|
2006-07-04 11:58:45 +08:00
|
|
|
def ngettext(singular, plural, number):
|
2013-10-17 16:17:41 +08:00
|
|
|
if number == 1:
|
|
|
|
return singular
|
2006-07-04 11:58:45 +08:00
|
|
|
return plural
|
|
|
|
ngettext_lazy = ngettext
|
|
|
|
|
2013-11-03 07:53:29 +08:00
|
|
|
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
def ungettext(singular, plural, number):
|
2012-07-21 16:00:10 +08:00
|
|
|
return force_text(ngettext(singular, plural, number))
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
|
2013-11-03 07:53:29 +08:00
|
|
|
|
2010-11-04 18:48:27 +08:00
|
|
|
def pgettext(context, message):
|
|
|
|
return ugettext(message)
|
|
|
|
|
2013-11-03 07:53:29 +08:00
|
|
|
|
2010-11-04 18:48:27 +08:00
|
|
|
def npgettext(context, singular, plural, number):
|
|
|
|
return ungettext(singular, plural, number)
|
|
|
|
|
2016-01-24 00:47:07 +08:00
|
|
|
|
|
|
|
def activate(x):
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
def deactivate():
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
deactivate_all = deactivate
|
|
|
|
|
|
|
|
|
|
|
|
def get_language():
|
|
|
|
return settings.LANGUAGE_CODE
|
|
|
|
|
|
|
|
|
|
|
|
def get_language_bidi():
|
|
|
|
return settings.LANGUAGE_CODE in settings.LANGUAGES_BIDI
|
|
|
|
|
|
|
|
|
|
|
|
def check_for_language(x):
|
|
|
|
return True
|
2006-07-14 10:55:42 +08:00
|
|
|
|
2013-11-03 07:53:29 +08:00
|
|
|
|
2007-04-05 11:22:49 +08:00
|
|
|
def gettext(message):
|
2014-05-26 03:25:23 +08:00
|
|
|
return message
|
2007-04-05 11:22:49 +08:00
|
|
|
|
2013-11-03 07:53:29 +08:00
|
|
|
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
def ugettext(message):
|
2012-07-21 16:00:10 +08:00
|
|
|
return force_text(gettext(message))
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
|
2007-04-05 11:25:30 +08:00
|
|
|
gettext_noop = gettext_lazy = _ = gettext
|
2007-04-05 11:22:49 +08:00
|
|
|
|
2013-11-03 07:53:29 +08:00
|
|
|
|
2006-07-14 10:55:42 +08:00
|
|
|
def to_locale(language):
|
|
|
|
p = language.find('-')
|
|
|
|
if p >= 0:
|
2013-11-04 02:08:55 +08:00
|
|
|
return language[:p].lower() + '_' + language[p + 1:].upper()
|
2006-07-14 10:55:42 +08:00
|
|
|
else:
|
|
|
|
return language.lower()
|
2006-07-28 00:38:32 +08:00
|
|
|
|
2013-11-03 07:53:29 +08:00
|
|
|
|
2012-02-18 21:37:30 +08:00
|
|
|
def get_language_from_request(request, check_path=False):
|
2006-07-28 00:38:32 +08:00
|
|
|
return settings.LANGUAGE_CODE
|
2011-06-16 01:29:10 +08:00
|
|
|
|
2013-11-03 07:53:29 +08:00
|
|
|
|
2013-11-12 14:54:01 +08:00
|
|
|
def get_language_from_path(request):
|
2011-06-16 01:29:10 +08:00
|
|
|
return None
|