I am developing a site in 2 languages, English and German. I have set up Translatable.
I woul like to setup the ability to create links in the template to switch between the 2 languages.
Here is the code I am using:
<% if Translations %>
<ul class="translations">
<% control Translations %>
<li class="$Locale.RFC1766">
<a href="$Link" hreflang="$Locale.RFC1766" title="$Title">
<% sprintf(_t('SHOWINPAGE','Show page in %s'),$Locale.Nice) %>
</a>
</li>
<% end_control %>
</ul>
<% end_if %>
This works for the German translation: It shows Show Page in German
It does no t work for the English translation, it shows Show Page in . It appears the variable
$Locale.Nice
is empty.
I then tried the following:
<% if Translations %>
<ul class="translations">
<% control Translations %>
<li class="$Locale.RFC1766">
<a href="$Link" hreflang="$Locale.RFC1766" title="$Title">
<% if Locale.RFC1766 == en_NZ %>
<% echo _t('SHOWINPAGE','Show page in English') %>
<% else %>
<% sprintf(_t('SHOWINPAGE','Show page in %s'),$Locale.Nice) %>
<% end_if %>
</a>
</li>
<% end_control %>
</ul>
<% end_if %>
It now comes with the following error message:
Parse error: syntax error, unexpected '}'