From 68141b6ca0391ee11fec5fb10bae8381c7e20b71 Mon Sep 17 00:00:00 2001 From: ARNHOE Date: Sat, 7 Sep 2013 16:10:52 +0200 Subject: [PATCH] i18n documentation - added note for caching in multi language modules --- docs/en/topics/i18n.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/en/topics/i18n.md b/docs/en/topics/i18n.md index 027aaa023..d67deb531 100644 --- a/docs/en/topics/i18n.md +++ b/docs/en/topics/i18n.md @@ -205,6 +205,17 @@ the PHP version of the function. // Using injection to add variables into the translated strings (note that $Name and $Greeting must be available in the current template scope). <%t Header.Greeting "Hello {name} {greeting}" name=$Name greeting=$Greeting %> + +#### Caching in Template Files with locale switching + +When caching a `<% loop %>` or `<% with %>` with `<%t params %>`. It is important to add the Locale to the cache key otherwise it won't pick up locale changes. + + ::::ss + <% cached 'MyIdentifier', $CurrentLocale %> + <% loop $Students %> + $Name + <% end_loop %> + <% end_cached %> ## Collecting text