Index: processors/main_processor.php =================================================================== --- processors/main_processor.php (revision 14592) +++ processors/main_processor.php (working copy) @@ -497,9 +497,32 @@ function Phrase($params) { $phrase_name = $this->SelectParam($params, 'label,name,title'); + $default_translation = $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 && $default_translation) { + $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', $default_translation); + } + + if ($phrase->Create()) { + $translation = $default_translation; + } + } + } + if (isset($params['escape']) && $params['escape']) { $translation = htmlspecialchars($translation, ENT_QUOTES); $translation = addslashes($translation);