Index: processors/main_processor.php =================================================================== --- processors/main_processor.php (revision 14592) +++ processors/main_processor.php (working copy) @@ -497,9 +497,31 @@ function Phrase($params) { $phrase_name = $this->SelectParam($params, 'label,name,title'); + $phrase_default = $this->SelectParam($params, 'default'); $no_editing = array_key_exists('no_editing', $params) && $params['no_editing']; - $translation = $this->Application->Phrase($phrase_name, !$no_editing); - + $translation = $this->Application->Phrase($phrase_name, !$no_editing); + if ( + strpos($translation, $phrase_name) !== false + && $phrase_default + ) { + $phrase =& $this->Application->recallObject('phrases.autocreate', null, Array('skip_autoload' => true)); + /* @var $phrase kDBItem */ + if (!$phrase->Load($phrase_name, 'PhraseKey')) { + $phrase->SetDBField('Phrase', $phrase_name); + $phrase->SetDBField('PhraseType', $this->Application->isAdmin ? 1 : 0); + $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); + /* @var $ml_helper kMultiLanguageHelper */ + $languages =& $ml_helper->getLanguages(); + foreach ($languages AS $language_id) { + $phrase->SetDBField('l'.$language_id.'_Translation', $phrase_default); + } + $phrase_event = new kEvent('phrases.autocreate:OnCreate'); + $this->Application->HandleEvent($phrase_event); + if ($phrase_event->status == erSUCCESS) { + $translation = $phrase_default; + } + } + } if (isset($params['escape']) && $params['escape']) { $translation = htmlspecialchars($translation, ENT_QUOTES); $translation = addslashes($translation);