Hi,
I'm kind of a newbie and maybe my question is dumb but i can't find a solution for my problem.
I am trying to translate my site but when i extend my Page class with an extra field and add it to the CMSFileds the Translations tab disappears from the CMS, and I cannot translate the page.
I've added the translations method _t() to the label of the field but still nothing.
I am using SilverStripe 2.4.3 with MYSQL and what I've setup:
My config file has:
-------------------------- _config.php --------------------------------------------------------
// Enable Translatable
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');
// Default locale language
Translatable::set_default_locale("en_US");
// Enable locale
i18n::enable();
// Set the default site locale
i18n::set_locale('en_US');
// Define allowed locales overriding those present in i18n::$common_locales
global $allowed_locales;
$allowed_locales = array(
'en_US' => array('English', 'English'),
'de_DE' => array('German', 'Deutsch')
);
i18n::$common_locales = $allowed_locales;
------------------------------------------------------------------------------------------------------
I've added to my Page.php in the controller init function and the extension:
--------------------------------- Page.php --------------------------------------------------------
public static $extensions = array(
"Translatable"
);
...... Page_Controller.....
if($this->dataRecord->hasExtension('Translatable')) {
i18n::set_locale($this->dataRecord->Locale);
}
------------------------------------------------------------------------------------------------------
Thanks in advance.