You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

trans_null.py 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. from django.conf import settings
  5. def gettext(message):
  6. return message
  7. gettext_noop = gettext_lazy = _ = gettext
  8. def ngettext(singular, plural, number):
  9. if number == 1:
  10. return singular
  11. return plural
  12. ngettext_lazy = ngettext
  13. def pgettext(context, message):
  14. return gettext(message)
  15. def npgettext(context, singular, plural, number):
  16. return ngettext(singular, plural, number)
  17. def activate(x):
  18. return None
  19. def deactivate():
  20. return None
  21. deactivate_all = deactivate
  22. def get_language():
  23. return settings.LANGUAGE_CODE
  24. def get_language_bidi():
  25. return settings.LANGUAGE_CODE in settings.LANGUAGES_BIDI
  26. def check_for_language(x):
  27. return True
  28. def get_language_from_request(request, check_path=False):
  29. return settings.LANGUAGE_CODE
  30. def get_language_from_path(request):
  31. return None
  32. def get_supported_language_variant(lang_code, strict=False):
  33. if lang_code == settings.LANGUAGE_CODE:
  34. return lang_code
  35. else:
  36. raise LookupError(lang_code)