Sorry, I don't like the _t() solution. _t() is ok for buttons, labels, "read more" links, etc, but it's not appropriate for translating content. What if the customer wants to edit his footer in the future? You won't tell him too edit Footer.ss and xx_YY.php. A footer is content, thus it should be managed and translated through the admin interface. I actually set my Footer.ss to <% control page(Footer) %>... for all my Silverstripe projects. This is the first time I need to make it bilingual.
I did some hacking and now this does that work for me:
function PageForCurrentLocale( $pagename ) {
if ( Object::has_extension('Page','Translatable') ) {
Translatable::$enable_lang_filter = false;
$page = DataObject::get_one("Page","URLSegment='$pagename'");
Translatable::$enable_lang_filter = true;
if ( empty($page) )
return;
else if ( Translatable::get_current_locale() != Translatable::default_locale() )
return $page->getTranslation( Translatable::get_current_locale() );
else
return $page;
}
}
just put it in your Page class and this one in your Footer.ss
<% control PageForCurrentLocale(footer) %>
$Content
<% end_control %>
Greetings
craesh