Hi guys,
I've got a simple staffmember dataobject. evrything works fine. But my client wantet the labels and vlaues to be translated. It's possible to get the atributes of the do translated by the static $field_label function. The DOM is translated by a single line in the _config.php (i18n::include_locale_file('dataobject_manager', 'de_DE');) . But there is a question left: How to translate the name of the dataobject itself? In the Backend, on the DOM, the "Add Staffmember" button should show "Mitarbeiter hinzufügen".
My code
<?php
class StaffMember extends DataObject
{
static $db = array (
'Anrede' => "Enum('Herr, Frau')",
'Vorname' => 'Varchar(100)',
'Name' => 'Varchar(255)',
'Role' => 'Varchar(100)',
'Phone' => 'Varchar(50)',
'Mail' => 'Varchar(50)',
'Location' => "Enum('Weißenfels, Zwickau')",
'Description' => 'Text',
'IsActive' => 'Boolean',
'ShowOnContactPage' => 'Boolean'
);
//1:n Beziehungen -> Staffmember hat eine Seite und ein Portraitbild
static $has_one = array (
'StaffPage' => 'StaffPage',
'Photo' => 'Image'
);
//Standardwerte für die Dropdowns im DOM
static $defaults = array(
'Anrede' => 'Herr',
'Location' => 'Weißenfels',
'IsActive' => 'true',
'ShowOnContactPage' => 'false'
);
//Fields to show in the DOM
//Todo checkbox in DOM für Anzeige auf der Kontaktseite
static $summary_fields = array(
'Photo.CMSThumbnail.Tag',
'Vorname' => 'Vorname',
'Name' => 'Name',
'Location' => 'Location',
'IsActive' => 'IsActive',
'ShowOnContactPage' => 'ShowOnContactPage'
);
static $field_labels = array(
'StaffMember' => 'Mitarbeiter',
'Role' => 'Stellenbeschreibung',
'Phone' => 'Telefon',
'Mail' => 'Mailadresse',
'Location' => 'Zweigstelle',
'Description' => 'Mitarbeiteraussage',
'IsActive' => 'aktiver Mitarbeiter',
'ShowOnContactPage' => 'Kontaktseitenanzeige',
);
.
.
.
.
}
Thanks for your help. Pipifix