Index: branches/5.0.x/core/kernel/languages/phrases_cache.php =================================================================== diff -u -r12320 -r12345 --- branches/5.0.x/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 12320) +++ branches/5.0.x/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 12345) @@ -1,6 +1,6 @@ Phrases)) { $translated_label = $this->Phrases[$label]; - if ($this->_editExisting && $allow_editing) { + if ($this->_editExisting && $allow_editing && !array_key_exists($label, $this->_missingPhrases)) { // option to change translation for Labels $edit_url = 'javascript:translate_phrase(\'' . addslashes($original_label) . '\', \'' . $this->_phraseEditTemplate . '\', {event: \'OnPrepareUpdate\', simple_mode: ' . ($this->_simpleEditingMode ? 'true' : 'false') . '});'; $translated_label = '<' . $this->_translateHtmlTag . ' href="' . $edit_url . '" name="cms-translate-phrase" title="Edit translation">' . $translated_label . '_translateHtmlTag . '>'; @@ -227,7 +234,7 @@ $this->LoadPhraseByLabel($label, $original_label, $allow_editing); - return $this->GetPhrase($label); + return $this->GetPhrase($label, $allow_editing); } function LoadPhraseByLabel($label, $original_label, $allow_editing = true) @@ -242,11 +249,13 @@ if ($this->_editMissing && $allow_editing) { $edit_url = 'javascript:translate_phrase(\'' . addslashes($original_label) . '\', \'' . $this->_phraseEditTemplate . '\', {event: \'OnNew\', simple_mode: ' . ($this->_simpleEditingMode ? 'true' : 'false') . '});'; - $translation = '<' . $this->_translateHtmlTag . ' href="' . $edit_url . '" class="cms-translate-phrase" title="Translate">!' . $label . '!_translateHtmlTag . '>'; + $translation = '<' . $this->_translateHtmlTag . ' href="' . $edit_url . '" name="cms-translate-phrase" title="Translate">!' . $label . '!_translateHtmlTag . '>'; if ($this->fromTag) { $translation = $this->escapeTagReserved($translation); } + + $this->_missingPhrases[$label] = true; // add as key for faster accessing } // add it as already cached, as long as we dont need to cache not found phrase @@ -285,22 +294,27 @@ * @return string * @access public */ - function ReplaceLanguageTags($text,$forse_escaping=null) + function ReplaceLanguageTags($text, $forse_escaping = null) { $this->fromTag = true; - if( isset($forse_escaping) ) $this->fromTag = $forse_escaping; + if( isset($forse_escaping) ) { + $this->fromTag = $forse_escaping; + } + preg_match_all("(!(la|lu)[^!]+!)", $text, $res, PREG_PATTERN_ORDER); $language_tags = $res[0]; - uasort($language_tags, Array(&$this, 'CmpParams') ); + uasort($language_tags, Array(&$this, 'CmpParams')); - $values = Array(); $i = 0; + $values = Array(); + foreach ($language_tags as $label) { array_push($values, $this->GetPhrase($label) ); //array_push($values, $this->Application->Phrase($label) ); $language_tags[$i] = '/' . $language_tags[$i] . '/'; $i++; } + $this->fromTag = false; return preg_replace($language_tags, $values, $text);