| 1 |
# These are versions of the functions in django.utils.translation.trans_real |
| 2 |
# that don't actually do anything. This is purely for performance, so that |
| 3 |
# settings.USE_I18N = False can use this module rather than trans_real.py. |
| 4 |
|
| 5 |
from django.conf import settings |
| 6 |
|
| 7 |
|
| 8 |
def gettext(message): |
| 9 |
return message |
| 10 |
|
| 11 |
|
| 12 |
gettext_noop = gettext_lazy = _ = gettext |
| 13 |
|
| 14 |
|
| 15 |
def ngettext(singular, plural, number): |
| 16 |
if number == 1: |
| 17 |
return singular |
| 18 |
return plural |
| 19 |
|
| 20 |
|
| 21 |
ngettext_lazy = ngettext |
| 22 |
|
| 23 |
|
| 24 |
def pgettext(context, message): |
| 25 |
return gettext(message) |
| 26 |
|
| 27 |
|
| 28 |
def npgettext(context, singular, plural, number): |
| 29 |
return ngettext(singular, plural, number) |
| 30 |
|
| 31 |
|
| 32 |
def activate(x): |
| 33 |
return None |
| 34 |
|
| 35 |
|
| 36 |
def deactivate(): |
| 37 |
return None |
| 38 |
|
| 39 |
|
| 40 |
deactivate_all = deactivate |
| 41 |
|
| 42 |
|
| 43 |
def get_language(): |
| 44 |
return settings.LANGUAGE_CODE |
| 45 |
|
| 46 |
|
| 47 |
def get_language_bidi(): |
| 48 |
return settings.LANGUAGE_CODE in settings.LANGUAGES_BIDI |
| 49 |
|
| 50 |
|
| 51 |
def check_for_language(x): |
| 52 |
return True |
| 53 |
|
| 54 |
|
| 55 |
def get_language_from_request(request, check_path=False): |
| 56 |
return settings.LANGUAGE_CODE |
| 57 |
|
| 58 |
|
| 59 |
def get_language_from_path(request): |
| 60 |
return None |
| 61 |
|
| 62 |
|
| 63 |
def get_supported_language_variant(lang_code, strict=False): |
| 64 |
if lang_code and lang_code.lower() == settings.LANGUAGE_CODE.lower(): |
| 65 |
return lang_code |
| 66 |
else: |
| 67 |
raise LookupError(lang_code) |