Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Translate the name of a dataobject (DOM)


2 Posts   671 Views


Community Member, 54 Posts

22 May 2012 at 1:53am

Edited: 22/05/2012 1:54am

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

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(
      '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


Forum Moderator, 4096 Posts

24 May 2012 at 7:36am

You can use $yourDOM->setAddTitle(_t('MyTranslation'));