hi,
TranslatableModelAdmin is still not working, even after a coplete new database setup :-(
here is my _config.php:
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('DATAOBJECTTOBETRANSLATED', 'Translatable');
Translatable::set_default_locale('de_DE');
Translatable::set_allowed_locales(array(
'de_DE',
'en_US',
'ru_RU',
'fr_FR',
'es_ES'
)
);
Even if i select a language different from my default locale, always the default locale is written into the db.
in TranslatableModelAdmin.php i found the following:
/**
* Returns all languages with languages already used appearing first.
* Called by the SSViewer when rendering the template.
*/
function LangSelector() {
if(Object::has_extension($this->modelClass, 'Translatable')) {
$member = Member::currentUser(); //check to see if the current user can switch langs or not
if(Permission::checkMember($member, 'VIEW_LANGS')) {
$dropdown = new LanguageDropdownField(
'LangSelector',
'Language',
array(),
$this->modelClass,
'Locale-English'
);
$dropdown->setValue(Translatable::get_current_locale());
return $dropdown;
}
//user doesn't have permission to switch langs so just show a string displaying current language
return i18n::get_locale_name( Translatable::get_current_locale() );
}
}
}
The method summary from http://api.silverstripe.org/sapphire/core/LanguageDropdownField.html says:
Constructor __construct (line 17)
Create a new LanguageDropdownField
LanguageDropdownField __construct (string $name, string $title, [array $dontInclude = array()], [string $translatingClass = 'SiteTree'], [string $list = 'Common-English'])
* string $name
* string $title
* array $dontInclude: list of languages that won't be included
* string $translatingClass: Name of the class with translated instances where to look for used languages
* string $list: Indicates the source language list. Can be either Common-English, Common-Native Locale
what is the job of $list? Why is it set to 'Locale-English'?
Why is it $dropdown->setValue(Translatable::get_current_locale());? Mustn't it be the value from line 19: Session::set('TranslatableModelAdmin.Locale', $_GET['locale']);?
There must be a reason why the default locale is written to db and not the selected language. Is nobody saving translations of dataobjects to db?
I am working on this for a couple of days and still got a answer from anybody. Pleaseeee help...