From 25be67ac219b19054cb0079ebfd604e4add1714e Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 18 Aug 2006 00:38:41 +0000 Subject: [PATCH] r1052: Remove the localization table and the XML strings concept from the language manager --- admin/language.php | 9 ++-- docs/schema_changes.sql | 2 +- includes/api_language.php | 2 - includes/class_admin_navigation.php | 1 - includes/init.php | 2 +- includes/language.php | 64 ----------------------------- 6 files changed, 6 insertions(+), 74 deletions(-) diff --git a/admin/language.php b/admin/language.php index 2f8e02b..4009734 100644 --- a/admin/language.php +++ b/admin/language.php @@ -185,18 +185,17 @@ if ($_REQUEST['do'] == 'modify') $admin->page_start(_('Manage Languages')); $admin->table_start(); - $admin->table_head(_('Manage Languages'), 4, 'language_manage'); + $admin->table_head(_('Manage Languages'), 3, 'language_manage'); - $admin->table_column_head(array(_('Title'), _('Charset'), _('Options'), _('Actions'))); + $admin->table_column_head(array(_('Title'), _('Charset'), _('Options'))); $languages = $db->query("SELECT * FROM " . TABLE_PREFIX . "language ORDER BY languageid ASC"); while ($language = $db->fetch_array($languages)) { $admin->row_multi_item(array( - $language['title'] => 'l', + "$language[title]" => 'l', $language['charset'] => 'c', - (($bugsys->options['defaultlanguage'] == $language['languageid']) ? '' . _('DEFAULT LANGUAGE') . ' / ' : '') . ($language['userselect'] ? _('User Selectable') : _('Private')) => 'c', - "[" . _('Edit Settings') . "] [" . _('Reload XML') . "]" => 'c' + (($bugsys->options['defaultlanguage'] == $language['languageid']) ? '' . _('DEFAULT LANGUAGE') . ' / ' : '') . ($language['userselect'] ? _('User Selectable') : _('Private')) => 'c' )); } diff --git a/docs/schema_changes.sql b/docs/schema_changes.sql index a2403e1..e796d88 100644 --- a/docs/schema_changes.sql +++ b/docs/schema_changes.sql @@ -1,3 +1,3 @@ ## SVN $Id$ - +DROP TABLE localization; diff --git a/includes/api_language.php b/includes/api_language.php index d6d1319..afbd1b3 100644 --- a/includes/api_language.php +++ b/includes/api_language.php @@ -72,7 +72,6 @@ class LanguageAPI extends API function post_insert() { build_languages(); - build_language_cache($this->insertid); } // ################################################################### @@ -113,7 +112,6 @@ class LanguageAPI extends API function post_delete() { build_languages(); - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "localization WHERE languageid = " . $this->values['languageid']); } // ################################################################### diff --git a/includes/class_admin_navigation.php b/includes/class_admin_navigation.php index 1db926f..fee9ba9 100644 --- a/includes/class_admin_navigation.php +++ b/includes/class_admin_navigation.php @@ -78,7 +78,6 @@ class NavLinks NavLinks::languagesAdd(); $navigator->add_component('link', 'options-languages-edit', 'options-languages', _('Edit Language'), 'language.php?do=edit&languageid=' . $id); - $navigator->add_component('link', 'options-languages-reload', 'options-languages', _('Reload XML'), 'language.php?do=reload&languageid=' . $id); $navigator->add_component('link', 'options-languages-delete', 'options-languages', _('Delete'), 'language.php?do=delete&languageid=' . $id); } diff --git a/includes/init.php b/includes/init.php index ed2b31e..58ce320 100755 --- a/includes/init.php +++ b/includes/init.php @@ -129,7 +129,7 @@ $bugsys->load('localize', 'lang', true); require_once('./includes/language.php'); $LANGDATA = fetch_user_language(); -$lang->init_with_table(fetch_strings($LANGDATA['id'])); +$lang->init_with_table(array()); $stylevar['lang'] = $LANGDATA['code']; $stylevar['lang_dir'] = $LANGDATA['direction']; diff --git a/includes/language.php b/includes/language.php index 8145994..6eadcde 100644 --- a/includes/language.php +++ b/includes/language.php @@ -24,70 +24,6 @@ $lang->setlex('error_invalid_id', _('That is an invalid ID.')); -// ################################################################### -// updates the localization cache -function build_language_cache($languageid) -{ - global $bugsys; - - $bugsys->db->query("DELETE FROM " . TABLE_PREFIX . "localization WHERE languageid = $languageid"); - - $localizations = fetch_strings($languageid, true); - foreach ($localizations AS $key => $value) - { - $bugsys->db->query("INSERT INTO " . TABLE_PREFIX . "localization (localkey, localtext, languageid) VALUES ('" . $bugsys->escape($key) . "', '" . $bugsys->escape($value) . "', $languageid)"); - } -} - -// ################################################################### -// fetches phrases from the system -function fetch_strings($languageid, $forcexml = false) -{ - global $bugsys; - - $language =& $bugsys->datastore['language']["$languageid"]; - - $locals = array(); - - if (!$language['languageid']) - { - return; - } - - if ($language['debug'] OR $forcexml) - { - if (!file_exists($language['filename'])) - { - trigger_error('Cannot load XML strings file', E_USER_WARNING); - return; - } - - $xmldata = file_get_contents($language['filename']); - if ($xmldata === false) - { - trigger_error('Error reading XML strings file', E_USER_WARNING); - return; - } - - $xml = $bugsys->xml->parse($xmldata); - foreach ($xml['localization']['string'] AS $string) - { - $locals[ $string['key']['value'] ] = $string['value']['value']; - } - } - else - { - $localizations = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "localization WHERE languageid = $languageid"); - while ($local = $bugsys->db->fetch_array($localizations)) - { - $locals["$local[localkey]"] = $local['localtext']; - } - $bugsys->db->free_result($localizations); - } - - return $locals; -} - // ################################################################### // determines the user's language function fetch_user_language() -- 2.43.5