3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 3176 Views |
-
Multi Language Issues

22 July 2009 at 10:23am
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
is empty.$Locale.Nice
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 '}'
-
Re: Multi Language Issues

2 August 2009 at 7:21pm
Hi there, I am having the same problem, it switches languages for me, but it does not say ' Show page in <language>', instead it says '<% sprintf(_t('SHOWINPAGE','Show page in %s'),$Locale.Nice)%>'.... The system doesn't seem to recognize this line of code.
Any tips?
I am running v2.3.2 at the moment. Thanks for sharing!!!
-
Re: Multi Language Issues

2 August 2009 at 8:31pm Last edited: 2 August 2009 8:32pm
Is there a space between
and$Locale.Nice)
%>
-
Re: Multi Language Issues

3 August 2009 at 2:44am
Thanks for the reply. I entered the spaces,
<% sprintf(_t('SHOWINPAGE','Show page in %s'),$Locale.Nice) %>
and it reads a little better iin the live site, it says: 'Show page in' But it still does not type the 'language name'.
It must be something easy to do for the system to type the name of the available language, the information in the silverstripe doc require updating I think...
Please help silverstripe team!
-
Re: Multi Language Issues

3 August 2009 at 2:48am
When I take out .nice
<% sprintf(_t('SHOWINPAGE','Show page in % s'),$Locale) %>
In the English site it reads:
'Show the page in en_GB'
In the Chinese site it reads:
'Show the page in zh_TW'
Now I just need the system to translate en_GB to say 'English', and zh_TW to say 'Chinese'
PLEASE HELP!!
-
Re: Multi Language Issues

23 August 2009 at 5:41pm
Hm, zh_TW is probably not in the i18n::$common_locales table, see http://doc.silverstripe.com/doku.php?id=multilingualcontent#add_new_locales
-
Re: Multi Language Issues

1 December 2009 at 12:02am
just in case someone else is struggling with this as well. this post helped me:
| 3176 Views | ||
|
Page:
1
|
Go to Top |




