mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
Fixed <% control %> usage in docs
This commit is contained in:
parent
20c2e9a190
commit
a9d9dae824
@ -363,14 +363,14 @@ below can be inserted in any of your templates, for example `themes/blackcandy/t
|
|||||||
:::php
|
:::php
|
||||||
<% if Translations %>
|
<% if Translations %>
|
||||||
<ul class="translations">
|
<ul class="translations">
|
||||||
<% control Translations %>
|
<% loop Translations %>
|
||||||
<li class="$Locale.RFC1766">
|
<li class="$Locale.RFC1766">
|
||||||
<a href="$Link" hreflang="$Locale.RFC1766"
|
<a href="$Link" hreflang="$Locale.RFC1766"
|
||||||
title="$Title">
|
title="$Title">
|
||||||
<% sprintf(_t('SHOWINPAGE','Show page in %s'),$Locale.Nice) %>
|
<% sprintf(_t('SHOWINPAGE','Show page in %s'),$Locale.Nice) %>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<% end_control %>
|
<% end_loop %>
|
||||||
</ul>
|
</ul>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ just work if your locale value is registered in i18n::get_common_locales().
|
|||||||
|
|
||||||
### Page-control
|
### Page-control
|
||||||
|
|
||||||
If you want to put static links in your template, which link to a site by their url, normally you can use the `<% control
|
If you want to put static links in your template, which link to a site by their url, normally you can use the `<% loop
|
||||||
Page(page-url) %>`. For sites which use Translatable, this is not possible for more than one language, because the url's
|
Page(page-url) %>`. For sites which use Translatable, this is not possible for more than one language, because the url's
|
||||||
of different pages differ.
|
of different pages differ.
|
||||||
|
|
||||||
@ -401,15 +401,15 @@ For this case place the following function in your Page_Controller:
|
|||||||
|
|
||||||
So, for example if you have a german page "Kontakt", which should be translated to english as "Contact", you may use:
|
So, for example if you have a german page "Kontakt", which should be translated to english as "Contact", you may use:
|
||||||
|
|
||||||
<% control PageByLang(Kontakt,de_DE) %>
|
<% loop PageByLang(Kontakt,de_DE) %>
|
||||||
|
|
||||||
The control displays the link in the right language, depending on the current locale.
|
The control displays the link in the right language, depending on the current locale.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
<% control PageByLang(Kontakt,de_DE) %>
|
<% loop PageByLang(Kontakt,de_DE) %>
|
||||||
<h2><a href="$Link" title="$Title">$Title</a></h2>
|
<h2><a href="$Link" title="$Title">$Title</a></h2>
|
||||||
<% end_control %>
|
<% end_loop %>
|
||||||
|
|
||||||
|
|
||||||
### Enabling the _t() function in templates
|
### Enabling the _t() function in templates
|
||||||
|
Loading…
Reference in New Issue
Block a user