Code source de Planète Casio https://planet-casio.com
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.

12 lines
398B

  1. from app import app
  2. @app.template_filter('pluralize')
  3. def pluralize(count, singular="", plural="s"):
  4. """
  5. Make a noun plural. Meant for templates; use it like this:
  6. Il y a {{ n }} groupe{{ n | pluralize }}.
  7. You can specify different suffixes if "s" is not relevant;
  8. Il y a {{ n }} hibou{{ n | pluralize("", "x") }}.
  9. """
  10. return singular if count <= 1 else plural