notes for Multilingual pages translatable in silverstripe:
http://www.silverstripe.org/translatable-module/ http://www.silverstripe.org/all-other-modules/show/19176
first set default language
i18n::set_locale('cs_CZ');
/dev/build/?flush=1
edit _config
//default translation
Translatable::set_default_locale('de_DE');
/* restrict the language select dropdown in the admin to only those languages that you will actually use. */
Translatable::set_allowed_locales(array(
'de_DE', //Deutsch 'en_GB', //UK English 'fr_FR', //Franz. 'it_IT' //Ital. ) ); Object::add_extension('SiteTree', 'Translatable'); Object::add_extension('SiteConfig', 'Translatable');
then add new language in backend
backend -> settings -> translations -> set new language!!
Add switcher
flaggen
<% if Translations %> <div id="lang" class="clear"> <ul class="clear"> <% control Translations %> <li> <a href="$Link" hreflang="$Locale.RFC1766" title="$Title - $Locale.Nice"> <img src="$ThemeDir/images/lang-<% sprintf(_t('IMAGE','%2.2s'),$Locale.RFC1766) %>.gif"> </a> </li> <% end_control %> </ul> </div> <% end_if %>
Add images of flags
lang-en.gif lang-de.gif lang-fr.gif lang-it.gif put them into: themes/yourtheme/images flush cache
text only switcher
<% if Translations %> <div id="lang" class="flags"> <ul class="flags"> <% control Translations %> <li> <a href="$Link" hreflang="$Locale.RFC1766" title="$Title - $Locale.Nice"> <% sprintf(_t('IMAGE','%2.2s'),$Locale.RFC1766) %> </a> </li> <% end_control %> </ul> </div> <% end_if %>
switch content per language
<% control Translations %> <% if Locale == "en_US" %> <a href="$Link">English version </a> <% end_if %> <% if Locale == "de_DE" %> <a href="$Link">Deutsche Version</a> <% end_if %> <% end_control %>
url segment
first create complete sitetree for one language then translate all or translate parent (holder) too
documentation
http://www.ssbits.com/tutorials/2011/using-translatable-to-create-a-simple-multilingual-site/ http://doc.silverstripe.org/framework/en/2.3/topics/translation