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.
 
 
 
 
 
 

62 lines
1.9 KiB

  1. # Examples taken from https://frappeframework.com/docs/user/en/translations
  2. # This file is used for testing the tests.
  3. from frappe import _
  4. full_name = "Jon Doe"
  5. # ok: frappe-translation-python-formatting
  6. _('Welcome {0}, get started with ERPNext in just a few clicks.').format(full_name)
  7. # ruleid: frappe-translation-python-formatting
  8. _('Welcome %s, get started with ERPNext in just a few clicks.' % full_name)
  9. # ruleid: frappe-translation-python-formatting
  10. _('Welcome %(name)s, get started with ERPNext in just a few clicks.' % {'name': full_name})
  11. # ruleid: frappe-translation-python-formatting
  12. _('Welcome {0}, get started with ERPNext in just a few clicks.'.format(full_name))
  13. subscribers = ["Jon", "Doe"]
  14. # ok: frappe-translation-python-formatting
  15. _('You have {0} subscribers in your mailing list.').format(len(subscribers))
  16. # ruleid: frappe-translation-python-splitting
  17. _('You have') + len(subscribers) + _('subscribers in your mailing list.')
  18. # ruleid: frappe-translation-python-splitting
  19. _('You have {0} subscribers \
  20. in your mailing list').format(len(subscribers))
  21. # ok: frappe-translation-python-splitting
  22. _('You have {0} subscribers') \
  23. + 'in your mailing list'
  24. # ruleid: frappe-translation-trailing-spaces
  25. msg = _(" You have {0} pending invoice ")
  26. # ruleid: frappe-translation-trailing-spaces
  27. msg = _("You have {0} pending invoice ")
  28. # ruleid: frappe-translation-trailing-spaces
  29. msg = _(" You have {0} pending invoice")
  30. # ok: frappe-translation-trailing-spaces
  31. msg = ' ' + _("You have {0} pending invoices") + ' '
  32. # ruleid: frappe-translation-python-formatting
  33. _(f"can not format like this - {subscribers}")
  34. # ruleid: frappe-translation-python-splitting
  35. _(f"what" + f"this is also not cool")
  36. # ruleid: frappe-translation-empty-string
  37. _("")
  38. # ruleid: frappe-translation-empty-string
  39. _('')
  40. class Test:
  41. # ok: frappe-translation-python-splitting
  42. def __init__(
  43. args
  44. ):
  45. pass