mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2395 from ARNHOE/patch-1
i18n documentation - added note for caching in multi language modules
This commit is contained in:
commit
634f73c710
@ -213,6 +213,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).
|
// 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 %>
|
<%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
|
## Collecting text
|
||||||
|
|
||||||
To collect all the text in code and template files we have just to visit:
|
To collect all the text in code and template files we have just to visit:
|
||||||
|
Loading…
Reference in New Issue
Block a user