diff --git a/docs/en/topics/i18n.md b/docs/en/topics/i18n.md index 79041d528..3f9ef98d5 100644 --- a/docs/en/topics/i18n.md +++ b/docs/en/topics/i18n.md @@ -212,6 +212,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