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.
 
 
 
 

26 line
906 B

  1. #!/usr/bin/env python3
  2. import gettext
  3. import os
  4. _LOCALE_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "../locales")
  5. _TRANSLATION = gettext.translation("messages", localedir=_LOCALE_DIR, fallback=True)
  6. _ = _TRANSLATION.gettext
  7. FULL_DATE_FORMAT = _("{day_of_week} {month} {day_number}, {year}").format(
  8. day_of_week="%A", month="%B", day_number="%d", year="%Y"
  9. )
  10. SHORT_DATETIME_FORMAT = _("{month} {day_number}, {hours}:{minutes}").format(
  11. month="%b", day_number="%d", hours="%H", minutes="%M"
  12. )
  13. SHORT_DATE_FORMAT = _("{month} {day_number}, {year}").format(
  14. month="%b", day_number="%d", year="%Y"
  15. )
  16. TIME_FORMAT = _("{hours}:{minutes}").format(hours="%H", minutes="%M")
  17. def ngettext(msgid1, msgid2, number):
  18. # Not using ngettext = _TRANSLATION.ngettext because the linter will give an invalid-name error otherwise
  19. return _TRANSLATION.ngettext(msgid1, msgid2, number)