SILENT KILLERPanel

Current Path: > > opt > alt > python37 > share > doc > alt-python37-jinja2 > examples > basic


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/alt/python37/share/doc/alt-python37-jinja2/examples/basic

NameTypeSizeLast ModifiedActions
templates Directory - -
cycle.py File 301 bytes April 05 2021 17:47:37.
debugger.py File 223 bytes April 05 2021 17:47:37.
inheritance.py File 392 bytes April 05 2021 17:47:37.
test.py File 675 bytes May 11 2021 23:25:55.
test_filter_and_linestatements.py File 456 bytes April 05 2021 17:47:37.
test_loop_filter.py File 301 bytes April 05 2021 17:47:37.
translate.py File 544 bytes April 05 2021 17:47:37.

Reading File: //opt/alt/python37/share/doc/alt-python37-jinja2/examples/basic/translate.py

from jinja2 import Environment

env = Environment(extensions=["jinja2.ext.i18n"])
env.globals["gettext"] = {"Hello %(user)s!": "Hallo %(user)s!"}.__getitem__
env.globals["ngettext"] = lambda s, p, n: {
    "%(count)s user": "%(count)d Benutzer",
    "%(count)s users": "%(count)d Benutzer",
}[s if n == 1 else p]
print(
    env.from_string(
        """\
{% trans %}Hello {{ user }}!{% endtrans %}
{% trans count=users|count -%}
{{ count }} user{% pluralize %}{{ count }} users
{% endtrans %}
"""
    ).render(user="someone", users=[1, 2, 3])
)

SILENT KILLER Tool