Index: branches/5.0.x/core/kernel/languages/phrases_cache.php =================================================================== diff -u -N -r12793 -r12871 --- branches/5.0.x/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 12793) +++ branches/5.0.x/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 12871) @@ -1,6 +1,6 @@ LanguageId = $this->Application->GetVar('m_lang'); + + if ($this->Application->GetVar('admin')) { + $admin_session =& $this->Application->recallObject('Session.admin'); + /* @var $admin_session Session */ + + $this->AdminLanguageId = $admin_session->GetField('Language'); + } } } @@ -199,7 +213,7 @@ } } - function GetPhrase($label, $allow_editing = true) + function GetPhrase($label, $allow_editing = true, $use_admin = false) { if (!isset($this->LanguageId)) { //actually possible when custom field contains references to language labels and its being rebuilt in OnAfterConfigRead @@ -235,12 +249,12 @@ return $translated_label; } - $this->LoadPhraseByLabel($label, $original_label, $allow_editing); + $this->LoadPhraseByLabel($label, $original_label, $allow_editing, $use_admin); return $this->GetPhrase($label, $allow_editing); } - function LoadPhraseByLabel($label, $original_label, $allow_editing = true) + function LoadPhraseByLabel($label, $original_label, $allow_editing = true, $use_admin = false) { if (!$allow_editing && !array_key_exists($label, $this->_missingPhrases) && array_key_exists($label, $this->Phrases)) { // label is aready translated, but it's version without on the fly translation code is requested @@ -249,9 +263,11 @@ return true; } + $language_id = $use_admin ? $this->AdminLanguageId : $this->LanguageId; + $sql = 'SELECT PhraseId, Translation FROM ' . TABLE_PREFIX . 'Phrase - WHERE (LanguageId = ' . $this->LanguageId . ') AND (PhraseKey = ' . $this->Conn->qstr($label) . ')'; + WHERE (LanguageId = ' . $language_id . ') AND (PhraseKey = ' . $this->Conn->qstr($label) . ')'; $res = $this->Conn->GetRow($sql); if ($res === false || count($res) == 0) {