Index: admin_templates/themes/extra_toolbar.tpl =================================================================== --- admin_templates/themes/extra_toolbar.tpl (revision 12677) +++ admin_templates/themes/extra_toolbar.tpl (working copy) @@ -9,7 +9,7 @@   - + Index: kernel/application.php =================================================================== --- kernel/application.php (revision 12677) +++ kernel/application.php (working copy) @@ -1920,9 +1920,9 @@ exit; } - function Phrase($label, $allow_editing = true) + function Phrase($label, $allow_editing = true, $use_admin = false) { - return $this->Phrases->GetPhrase($label, $allow_editing); + return $this->Phrases->GetPhrase($label, $allow_editing, $use_admin); } /** Index: kernel/db/db_tag_processor.php =================================================================== --- kernel/db/db_tag_processor.php (revision 12677) +++ kernel/db/db_tag_processor.php (working copy) @@ -2145,9 +2145,16 @@ if (!isset($language_code)) { $language_code = 'en'; // defaut value + if ($this->Application->IsAdmin()) { + $language_id = $this->Application->Phrases->LanguageId; + } + else { + $language_id = $this->Application->GetDefaultLanguageId(); // $this->Application->GetVar('m_lang'); + } + $sql = 'SELECT Locale FROM '. $this->Application->getUnitOption('lang', 'TableName') . ' - WHERE LanguageId = ' . $this->Application->GetDefaultLanguageId(); // $this->Application->GetVar('m_lang'); + WHERE LanguageId = ' . $language_id; $locale = strtolower( $this->Conn->GetOne($sql) ); if (file_exists(FULL_PATH . EDITOR_PATH . 'editor/lang/' . $locale . '.js')) { Index: kernel/languages/phrases_cache.php =================================================================== --- kernel/languages/phrases_cache.php (revision 12677) +++ kernel/languages/phrases_cache.php (working copy) @@ -30,6 +30,13 @@ var $LanguageId = null; + /** + * Administrator's language, when visiting site (from frame) + * + * @var int + */ + var $AdminLanguageId = null; + var $fromTag = false; /** @@ -118,6 +125,13 @@ } else { $this->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,17 +249,18 @@ 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) { - // bug: MySQL don't use index on Phrase column, when function is used on it's value (e.g. UPPER, like in this case) + $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) { Index: units/categories/categories_tag_processor.php =================================================================== --- units/categories/categories_tag_processor.php (revision 12677) +++ units/categories/categories_tag_processor.php (working copy) @@ -1194,7 +1194,7 @@
-
' . $this->Application->Phrase('la_btn_EditContent', false) . ' '.(defined('DEBUG_MODE') && DEBUG_MODE ? " - #{$num}" : '').'
+
' . $this->Application->Phrase('la_btn_EditContent', false, true) . ' '.(defined('DEBUG_MODE') && DEBUG_MODE ? " - #{$num}" : '').'
'; @@ -1474,7 +1474,7 @@
-
' . $this->Application->Phrase('la_btn_SectionProperties', false) . '
+
' . $this->Application->Phrase('la_btn_SectionProperties', false, true) . '
' . "\n"; } elseif (EDITING_MODE == EDITING_MODE_DESIGN) { $url_params = Array( @@ -1499,13 +1499,13 @@
-
' . $this->Application->Phrase('la_btn_SaveChanges', false) . '
+
' . $this->Application->Phrase('la_btn_SaveChanges', false, true) . '
-
' . $this->Application->Phrase('la_btn_Cancel', false) . '
+
' . $this->Application->Phrase('la_btn_Cancel', false, true) . '
@@ -1513,7 +1513,7 @@
-
' . $this->Application->Phrase('la_btn_SectionTemplate', false) . '
+
' . $this->Application->Phrase('la_btn_SectionTemplate', false, true) . '
' . "\n"; } Index: units/sections/site_config_tp.php =================================================================== --- units/sections/site_config_tp.php (revision 12677) +++ units/sections/site_config_tp.php (working copy) @@ -19,9 +19,9 @@ function PrintEditingModes($params) { $editing_modes = Array ( - EDITING_MODE_BROWSE => Array ('image' => 'browse_site_mode', 'title' => 'Browse Mode'), - EDITING_MODE_CONTENT => Array ('image' => 'content_mode', 'title' => 'Content Mode'), - EDITING_MODE_DESIGN => Array ('image' => 'design_mode', 'title' => 'Design Mode'), + EDITING_MODE_BROWSE => Array ('image' => 'browse_site_mode', 'title' => 'la_btn_BrowseMode'), + EDITING_MODE_CONTENT => Array ('image' => 'content_mode', 'title' => 'la_btn_ContentMode'), + EDITING_MODE_DESIGN => Array ('image' => 'design_mode', 'title' => 'la_btn_DesignMode'), ); $site_config_helper =& $this->Application->recallObject('SiteConfigHelper');