Beispiel #1
0
 private function createEmptyTranslation($locale, $messageId)
 {
     // don't create translation if it's just empty
     if (array_key_exists($messageId, $this->_translate[$locale])) {
         return;
     }
     // no translation found create key
     if (Pimcore_Tool::isValidLanguage($locale)) {
         try {
             $t = Translation_Website::getByKey($messageId);
         } catch (Exception $e) {
             $t = new Translation_Website();
             $t->setKey($messageId);
         }
         $t->addTranslation($locale, "");
         $t->save();
     }
 }
 public function getAvailableLanguagesAction()
 {
     if ($languages = Pimcore_Tool::getValidLanguages()) {
         $this->_helper->json($languages);
     }
     $t = new Translation_Website();
     $this->_helper->json($t->getAvailableLanguages());
 }
<?php

// get db connection
$db = Pimcore_Resource::get();
foreach (array('translations_website', 'translations_admin') as $type) {
    $db->query('ALTER TABLE ' . $type . ' CHANGE `date` `creationDate` BIGINT(20) UNSIGNED NULL DEFAULT NULL');
    $db->query('ALTER TABLE ' . $type . ' ADD `modificationDate` BIGINT(20) UNSIGNED NULL DEFAULT NULL');
    $db->query('UPDATE ' . $type . ' SET modificationDate = creationDate');
    Translation_Website::clearDependentCache();
}