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.
 
 
 
 

58 lines
1.4 KiB

  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. from django.utils.encoding import force_text
  6. def ngettext(singular, plural, number):
  7. if number == 1:
  8. return singular
  9. return plural
  10. ngettext_lazy = ngettext
  11. def ungettext(singular, plural, number):
  12. return force_text(ngettext(singular, plural, number))
  13. def pgettext(context, message):
  14. return ugettext(message)
  15. def npgettext(context, singular, plural, number):
  16. return ungettext(singular, plural, number)
  17. activate = lambda x: None
  18. deactivate = deactivate_all = lambda: None
  19. get_language = lambda: settings.LANGUAGE_CODE
  20. get_language_bidi = lambda: settings.LANGUAGE_CODE in settings.LANGUAGES_BIDI
  21. check_for_language = lambda x: True
  22. def gettext(message):
  23. return message
  24. def ugettext(message):
  25. return force_text(gettext(message))
  26. gettext_noop = gettext_lazy = _ = gettext
  27. def to_locale(language):
  28. p = language.find('-')
  29. if p >= 0:
  30. return language[:p].lower() + '_' + language[p + 1:].upper()
  31. else:
  32. return language.lower()
  33. def get_language_from_request(request, check_path=False):
  34. return settings.LANGUAGE_CODE
  35. def get_language_from_path(request):
  36. return None