Skip to content
Myr

[svn] some more doc updates

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 0cd0d9a · Browse files · 1 file+76 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+76 added−0 removed

  • other:+76 added−0 removed

1 file+76 added−0 removed

modified:docs/src/designerdoc.txt+76 added
84 unmodified lines
85``escape``. Here the complete list of supported filters:8687[[list_of_filters]]8889.. admonition:: note9091 Filters have a pretty low priority. If you want to add fitered values92 you have to put them into parenthesis. Also you you want to access93 attributes:9495 .. sourcecode:: jinja9697 correct:98 {{ (foo|filter) + (bar|filter) }}99 wrong:100 {{ foo|filter + bar|filter }}101102 correct:103 {{ (foo|filter).attribute }}104 wrong:105 {{ foo|filter.attribute }}106107Tests108=====109110You can use the `is`-operator to perform tests on a value:
371 unmodified lines
482and `macro` two additional rules exist. If a macro is defined in an extended483template but outside of a visible block (thus outside of any block) will be484available in all blocks below. This allows you to use `include` statements to485load often used macros at once.486487Internationalization488====================489490If the application is configured for i18n you can define translatable blocks491for translators using the `trans` tag or the special underscore function:492493.. sourcecode:: jinja494495 {% trans %}496 this is a translatable block497 {% endtrans %}498499 {% trans "This is a translatable string" %}500501 {{ _("This is a translatable string") }}502503The latter one is useful if you want translatable arguments for filters etc.504505If you want to have plural forms too use the `pluralize` block:506507.. sourcecode:: jinja508509 {% trans users=users %}510 One user found.511 {% pluralize %}512 {{ users }} users found.513 {% endtrans %}514515 {% trans first=(users|first).username|escape, user=users|length %}516 one user {{ first }} found.517 {% pluralize users %}518 {{ users }} users found, the first one is called {{ first }}.519 {% endtrans %}520521If you have multiple arguments the first one is assumed to be the indicator (the522number that is used to determine the correct singular or plural form. If you523don't have the indicator variable on position 1 you have to tell the `pluralize`524tag the correct variable name.525526Inside of translatable blocks you cannot use blocks or expressions. the variable527print syntax (``{{ variablename }}``) is just used to insert the variables defined528in the ``trans`` header.529530.. admonition:: note531532 Please make sure that you always use pluralize blocks where required.533 Many languages have more complex plural forms than the english language.534 535 Never try to workaround that issue by using something like this:536537 .. sourcecode:: jinja538539 {% if count != 1 %}540 {{ count }} users found.541 {% else %}542 one user found.543 {% endif %}