Polish pluralization for Django templates.
Project description
Simple Django plugin providing pluralize_pl template filter that works similarly to Django’s built-in pluralize plugin but respects Polish grammar rules.
The plugin only makes sense in project that doesn’t use Django’s translation system, which already has built-in support for pluralization based on grammar rules of the target language.
Quick start
Install the plugin from PyPi:
pip install django-pluralize-pl
Add pluralize_pl to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'pluralize_pl', ]
Load pluralize_pl in your templates:
{% load pluralize_pl %}
Use the pluralize_pl filter when you need it:
{{ comments | pluralize_pl:"komentarz,komentarzy,komentarze" }}
Overview
pluralize_pl is fully compatible with Django’s pluralize filter. It works the same as long as you are giving it up to 2 comma-separated arguments. The difference is, you can provide it with a third argument, which will be used as a second plural form and applied according to Polish grammar rules:
If value is 0, {{ value|pluralize_pl:"komentarz,komentarzy,komentarze" }} displays “komentarzy”.
If value is 1, {{ value|pluralize_pl:"komentarz,komentarzy,komentarze" }} displays “komentarz”.
If value is 2, {{ value|pluralize_pl:"komentarz,komentarzy,komentarze" }} displays “komentarze”.
If value is 5, {{ value|pluralize_pl:"komentarz,komentarzy,komentarze" }} displays “komentarzy”.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-pluralize-pl-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c2a6d706d8452ab31efb729c2fb03f5feb4e4a8848fb3aa1ef573138f956697 |
|
MD5 | 83b4335261ff1a4e1088a5d860deda04 |
|
BLAKE2b-256 | 0f63c8a4ce457577b722a4f33b98bb53bc28c0f73bf48be3851e6644f614a154 |