[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
Provenance
- Commit
9061e54- Tree
11a4e2d- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
0cd0d9a
1 file changed+76 added−0 removed
modified:docs/src/designerdoc.txt+76 added
84 unmodified lines85 ``escape``. Here the complete list of supported filters:86 87 [[list_of_filters]]88 89+.. admonition:: note90+91+ 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:94+95+ .. sourcecode:: jinja96+97+ correct:98+ {{ (foo|filter) + (bar|filter) }}99+ wrong:100+ {{ foo|filter + bar|filter }}101+102+ correct:103+ {{ (foo|filter).attribute }}104+ wrong:105+ {{ foo|filter.attribute }}106+107 Tests108 =====109 110 You can use the `is`-operator to perform tests on a value:371 unmodified lines482 and `macro` two additional rules exist. If a macro is defined in an extended483 template but outside of a visible block (thus outside of any block) will be484 available in all blocks below. This allows you to use `include` statements to485 load often used macros at once.486+487+Internationalization488+====================489+490+If the application is configured for i18n you can define translatable blocks491+for translators using the `trans` tag or the special underscore function:492+493+.. sourcecode:: jinja494+495+ {% trans %}496+ this is a translatable block497+ {% endtrans %}498+499+ {% trans "This is a translatable string" %}500+501+ {{ _("This is a translatable string") }}502+503+The latter one is useful if you want translatable arguments for filters etc.504+505+If you want to have plural forms too use the `pluralize` block:506+507+.. sourcecode:: jinja508+509+ {% trans users=users %}510+ One user found.511+ {% pluralize %}512+ {{ users }} users found.513+ {% endtrans %}514+515+ {% 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 %}520+521+If you have multiple arguments the first one is assumed to be the indicator (the522+number that is used to determine the correct singular or plural form. If you523+don't have the indicator variable on position 1 you have to tell the `pluralize`524+tag the correct variable name.525+526+Inside of translatable blocks you cannot use blocks or expressions. the variable527+print syntax (``{{ variablename }}``) is just used to insert the variables defined528+in the ``trans`` header.529+530+.. admonition:: note531+532+ 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:536+537+ .. sourcecode:: jinja538+539+ {% if count != 1 %}540+ {{ count }} users found.541+ {% else %}542+ one user found.543+ {% endif %}