translate.py
This file
Path
examples/basic/translate.py
20 lines · 582 bytes · Python
Last changed by
Merge pull request #1133 from pallets/revert-renameDavid Lordbefore adoption15337f7
History of this fileTake it
The walk stopped after 200 commits: lines older than 793ddd4 point at it.
Merge pull request #1093 from cclauss/print-functionDavid Lordbefore adoption4c95c5f
line 1why, one step back1from __future__ import print_functionMerge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
line 2why, one step back2Merge pull request #1133 from pallets/revert-renameDavid Lordbefore adoption15337f7
line 3why, one step back3from jinja2 import EnvironmentMerge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
line 4why, one step back4Merge pull request #1133 from pallets/revert-renameDavid Lordbefore adoption15337f7
line 5why, one step back5env = Environment(extensions=["jinja2.ext.i18n"])Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
lines 6–9why, one step back6env.globals["gettext"] = {"Hello %(user)s!": "Hallo %(user)s!"}.__getitem__7env.globals["ngettext"] = lambda s, p, n: {8 "%(count)s user": "%(count)d Benutzer",9 "%(count)s users": "%(count)d Benutzer",Merge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
line 10why, one step back10}[n == 1 and s or p]Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
lines 11–13why, one step back11print(12 env.from_string(13 """\Merge branch '2.9-maintenance'Armin Ronacherbefore adoption793ddd4
line 14why, one step back14{% trans %}Hello {{ user }}!{% endtrans %}Merge pull request #1125 from pallets/styleDavid Lordbefore adoption42d4a4e
lines 15–20why, one step back15{% trans count=users|count -%}16{{ count }} user{% pluralize %}{{ count }} users17{% endtrans %}18"""19 ).render(user="someone", users=[1, 2, 3])20)