From 8ecb96acbad5da398203751b284467b1414b755d Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 24 Sep 2005 18:00:21 +0000 Subject: [PATCH] r433: Merging the locale-change branch onto trunk; we now use ISSO's localize system --- admin/autoaction.php | 48 +- admin/field.php | 76 +- admin/global.php | 42 +- admin/index.php | 2 +- admin/jump.php | 2 +- admin/language.php | 92 +- admin/priority.php | 28 +- admin/product.php | 88 +- admin/resolution.php | 28 +- admin/setting.php | 20 +- admin/severity.php | 28 +- admin/status.php | 32 +- admin/usergroup.php | 121 +- attachment.php | 28 +- docs/lang_file_import.php | 33 - docs/lang_file_master.xml | 1980 ++++++++++++++++++++++++--- docs/lang_registry_converter.php | 94 -- docs/lang_registry_populator.php | 76 - docs/lang_registry_replacer.php | 92 -- docs/phrasetools.php | 213 --- docs/schema_changes.sql | 22 +- editcomment.php | 6 +- editreport.php | 10 +- favourite.php | 8 +- includes/adminfunctions.php | 36 +- includes/class_language.php | 220 --- includes/class_message_reporter.php | 37 +- includes/functions.php | 2 +- includes/init.php | 24 +- includes/language.php | 99 ++ includes/settings.php | 46 +- login.php | 14 +- newcomment.php | 2 +- newreport.php | 8 +- register.php | 69 +- search.php | 4 +- showhistory.php | 2 +- showreport.php | 6 +- viewattachment.php | 2 +- vote.php | 8 +- 40 files changed, 2457 insertions(+), 1291 deletions(-) delete mode 100644 docs/lang_file_import.php delete mode 100644 docs/lang_registry_converter.php delete mode 100755 docs/lang_registry_populator.php delete mode 100755 docs/lang_registry_replacer.php delete mode 100644 docs/phrasetools.php delete mode 100644 includes/class_language.php create mode 100644 includes/language.php diff --git a/admin/autoaction.php b/admin/autoaction.php index 7bea3c0..26332e2 100644 --- a/admin/autoaction.php +++ b/admin/autoaction.php @@ -31,7 +31,7 @@ if ($_REQUEST['do'] == 'kill') $action = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "autoaction WHERE actionid = " . intval($bugsys->in['actionid'])); if (!$action) { - $admin->error(lang::p('error_invalid_id')); + $admin->error($lang->getlex('error_invalid_id')); } $db->query("DELETE FROM " . TABLE_PREFIX . "autoaction WHERE actionid = $action[actionid]"); @@ -46,10 +46,10 @@ if ($_REQUEST['do'] == 'delete') $action = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "autoaction WHERE actionid = " . intval($bugsys->in['actionid'])); if (!$action) { - $admin->error(lang::p('error_invalid_id')); + $admin->error($lang->getlex('error_invalid_id')); } - $admin->page_confirm(lang::p('confirm_action_delete'), "autoaction.php?do=kill&actionid=$action[actionid]"); + $admin->page_confirm($lang->string('Are you sure you want to delete this action?'), "autoaction.php?do=kill&actionid=$action[actionid]"); } // ################################################################### @@ -58,7 +58,7 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') { if (empty($bugsys->in['name'])) { - $admin->error(lang::p('error_need_action_name')); + $admin->error($lang->string('You need to specify a name for this action.')); } foreach ($bugsys->in['fields'] AS $key => $value) @@ -79,7 +79,7 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') if (count($deltas['custom']) < 1 AND count($deltas['builtin']) < 1) { - $admin->error(lang::p('custom_field_error_need_field_changes')); + $admin->error($lang->string('You need to specify some fields to change.')); } if ($_POST['do'] == 'insert') @@ -99,7 +99,7 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') { if (!$bugsys->in['actionid']) { - $admin->error(lang::p('error_invalid_id')); + $admin->error($lang->getlex('error_invalid_id')); } $db->query(" @@ -127,14 +127,14 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') $action = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "autoaction WHERE actionid = " . intval($bugsys->in['actionid'])); if (!$action) { - $admin->error(lang::p('error_invalid_id')); + $admin->error($lang->getlex('error_invalid_id')); } $action['fields'] = unserialize($action['fieldchanges']); } - $admin->page_start(lang::p((($add) ? 'new_auto_action' : 'edit_auto_action'))); + $admin->page_start(($add ? $lang->string('New Automatic Action') : $lang->string('Edit Automatic Action'))); - $admin->form_start('autoaction.php', (($add) ? 'insert' : 'update')); + $admin->form_start('autoaction.php', ($add ? 'insert' : 'update')); if ($edit) { @@ -142,27 +142,27 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') } $admin->table_start(); - $admin->table_head(lang::p((($add) ? 'new_auto_action' : 'edit_auto_action'))); + $admin->table_head(($add ? $lang->string('New Automatic Action') : $lang->string('Edit Automatic Action'))); - $admin->row_input(lang::p('name'), 'name', $action['name']); - $admin->row_textarea(lang::p('description'), 'description', $action['description']); - $admin->row_textarea(lang::p('add_comment'), 'comment', $action['comment']); + $admin->row_input($lang->string('Name'), 'name', $action['name']); + $admin->row_textarea($lang->string('Description'), 'description', $action['description']); + $admin->row_textarea($lang->string('Add Comment'), 'comment', $action['comment']); - $admin->row_span(lang::p('field_changes'), 'thead', 'center'); + $admin->row_span($lang->string('Field Changes'), 'thead', 'center'); // ------------------------------------------------------------------- // built-in fields construct_datastore_select('severity', 'severity', 'severityid', $action['fields']['builtin']['severity'], true, true); - $admin->row_list(lang::p('severity'), 'fields[severity]'); + $admin->row_list($lang->string('Severity'), 'fields[severity]'); construct_datastore_select('priority', 'priority', 'priorityid', $action['fields']['builtin']['priority'], true, true); - $admin->row_list(lang::p('priority'), 'fields[priority]'); + $admin->row_list($lang->string('Priority'), 'fields[priority]'); construct_datastore_select('status', 'status', 'statusid', $action['fields']['builtin']['status'], true, true); - $admin->row_list(lang::p('status'), 'fields[status]'); + $admin->row_list($lang->string('Status'), 'fields[status]'); construct_datastore_select('resolution', 'resolution', 'resolutionid', $action['fields']['builtin']['resolution'], true, true); - $admin->row_list(lang::p('resolution'), 'fields[resolution]'); + $admin->row_list($lang->string('Resolution'), 'fields[resolution]'); $admin->row_span('', 'tcat', 'center'); @@ -187,8 +187,8 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') case 'input_checkbox': $admin->list_item('', 0, ((!$action['fields']['custom']["$field[fieldid]"]) ? true : false)); - $admin->list_item(lang::p('checked'), 1, (($action['fields']['custom']["$field[fieldid]"] == 1) ? true : false)); - $admin->list_item(lang::p('unchecked'), 2, (($action['fields']['custom']["$field[fieldid]"] == 2) ? true : false)); + $admin->list_item($lang->string('Checked'), 1, (($action['fields']['custom']["$field[fieldid]"] == 1) ? true : false)); + $admin->list_item($lang->string('Un-Checked'), 2, (($action['fields']['custom']["$field[fieldid]"] == 2) ? true : false)); $admin->row_list($field['name'], "fields[custom][$field[fieldid]]"); break; @@ -218,18 +218,18 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { - $admin->page_start(lang::p('automatic_actions')); + $admin->page_start($lang->string('Automatic Actions')); $admin->table_start(); - $admin->table_head(lang::p('automatic_actions')); + $admin->table_head($lang->string('Automatic Actions')); $actions = $db->query("SELECT * FROM " . TABLE_PREFIX . "autoaction ORDER BY name ASC"); while ($action = $db->fetch_array($actions)) { - $admin->row_text($action['name'] . "\n
$action[description]
", "[" . lang::p('edit') . "] [" . lang::p('delete') . "]"); + $admin->row_text($action['name'] . "\n
$action[description]
", "[" . $lang->string('Edit') . "] [" . $lang->string('Delete') . "]"); } - $admin->row_span('[' . lang::p('new_auto_action') . ']', 'tfoot', 'center', 3); + $admin->row_span('[' . $lang->string('New Automatic Action') . ']', 'tfoot', 'center', 3); $admin->table_end(); $admin->page_end(); diff --git a/admin/field.php b/admin/field.php index e90e23f..532cf0d 100644 --- a/admin/field.php +++ b/admin/field.php @@ -18,9 +18,9 @@ if (!can_perform('canadminfields')) } $TYPES = array( - 'input_text' => lang::p('single_line_text_box'), - 'input_checkbox' => lang::p('checkbox_flag'), - 'select_single' => lang::p('drop_dwon_menu'), + 'input_text' => $lang->string('Single-Line Text Box'), + 'input_checkbox' => $lang->string('Checkbox Flag'), + 'select_single' => $lang->string('Drop-Down Menu'), ); // ################################################################### @@ -37,7 +37,7 @@ if ($_REQUEST['do'] == 'kill') $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = " . intval($bugsys->in['fieldid'])); if (!$field) { - $admin->error(lang::p('error_invalid_id')); + $admin->error($lang->getlex('error_invalid_id')); } $db->query("DELETE FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = $field[fieldid]"); @@ -55,10 +55,10 @@ if ($_REQUEST['do'] == 'delete') $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = " . intval($bugsys->in['fieldid'])); if (!$field) { - $admin->error(lang::p('error_invalid_id')); + $admin->error($lang->getlex('error_invalid_id')); } - $admin->page_confirm(lang::p('confirm_custom_field_delete'), "field.php?do=kill&fieldid=$field[fieldid]"); + $admin->page_confirm($lang->string('Are you sure you want to delete this bug field? Doing so will remove everything for this field and it cannot be undone!'), "field.php?do=kill&fieldid=$field[fieldid]"); } // ################################################################### @@ -75,7 +75,7 @@ if ($_REQUEST['do'] == 'update') $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = " . intval($bugsys->in['fieldid'])); if (!$field) { - $admin->error(lang::p('error_invalid_id')); + $admin->error($lang->getlex('error_invalid_id')); } $edit = true; @@ -85,11 +85,11 @@ if ($_REQUEST['do'] == 'update') if (empty($bugsys->in['name'])) { - $admin->error(lang::p('error_need_display_name')); + $admin->error($lang->string('You must specify a display name.')); } if (!isset($TYPES["$type"]) AND $add) { - $admin->error(lang::p('invalid_field_type')); + $admin->error($lang->string('Invalid field type specified.')); } switch ($type) @@ -115,7 +115,7 @@ if ($_REQUEST['do'] == 'update') array_walk($selects, 'trim'); if (count($selects) < 1) { - $admin->error(lang::p('custom_field_need_values')); + $admin->error($lang->string('You need to specify some select values.')); } $extradata = "'" . $bugsys->escape(serialize($selects)) . "', " . intval($bugsys->in['usedefault']); @@ -152,8 +152,8 @@ if ($_REQUEST['do'] == 'update') WHERE fieldid = " . intval($bugsys->in['fieldid']) ); } - - $admin->redirect('field.php?do=modify', lang::p((($add) ? 'custom_field_added' : 'custom_field_updated'))); + + $admin->redirect('field.php?do=modify', ($add ? $lang->string('The custom field has been added') : $lang->string('The custom field has been updated'))); } // ################################################################### @@ -164,8 +164,8 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') $typeselect = (($add AND empty($bugsys->in['step'])) ? true : false); $edit = (($add) ? false : true); - $admin->page_start(lang::p((($add) ? 'add_new_field' : 'edit_field'))); - $admin->form_start('field.php', (($typeselect) ? 'add' : 'update')); + $admin->page_start(($add ? $lang->string('Add New Custom Field') : $lang->string('Edit Custom Field'))); + $admin->form_start('field.php', ($typeselect ? 'add' : 'update')); if ($add AND !$typeselect) { $admin->form_hidden_field('type', $bugsys->in['type']); @@ -174,12 +174,12 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') { $admin->form_hidden_field('step', 1); $admin->table_start(true, '40%'); - $admin->table_head(lang::p('select_type')); + $admin->table_head($lang->string('Select Type')); } else { $admin->table_start(); - $admin->table_head((($add) ? lang::p('add_new_field') . ' - ' . $TYPES[ $bugsys->in['type'] ] : lang::p('edit_field'))); + $admin->table_head(($add ? $lang->string('Add New Bug Field') . ' - ' . $TYPES[ $bugsys->in['type'] ] : $lang->string('Edit Field'))); } if ($edit) @@ -187,7 +187,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = " . intval($bugsys->in['fieldid'])); if (!$field) { - $admin->error(lang::p('error_invalid_id')); + $admin->error($lang->getlex('error_invalid_id')); } $admin->form_hidden_field('fieldid', $field['fieldid']); @@ -205,7 +205,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') { $admin->list_item($description, $name); } - $admin->row_list(lang::p('field_type'), 'type', false); + $admin->row_list($lang->string('Field Type'), 'type', false); $admin->row_submit(); $admin->table_end(); @@ -215,40 +215,40 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') { if (!isset($TYPES["$type"])) { - $admin->error(lang::p('error_invalid_id')); + $admin->error($lang->getlex('error_invalid_id')); } // global fields - $admin->row_span(lang::p('global_fields'), 'thead', 'center'); - $admin->row_text(lang::p('field_type'), $TYPES["$type"]); - $admin->row_input(lang::p('display_name'), 'name', $field['name']); - $admin->row_textarea(lang::p('description'), 'description', $field['description']); - $admin->row_yesno(lang::p('required'), 'required', $field['required']); - $admin->row_yesno(lang::p('can_be_searched'), 'cansearch', ((isset($field['cansearch'])) ? $field['cansearch'] : true)); + $admin->row_span($lang->string('Global Fields'), 'thead', 'center'); + $admin->row_text($lang->string('Field Type'), $TYPES["$type"]); + $admin->row_input($lang->string('Display Name'), 'name', $field['name']); + $admin->row_textarea($lang->string('Description'), 'description', $field['description']); + $admin->row_yesno($lang->string('Required'), 'required', $field['required']); + $admin->row_yesno($lang->string('Can Be Searched'), 'cansearch', ((isset($field['cansearch'])) ? $field['cansearch'] : true)); // type-specific fields - $admin->row_span(lang::p('type_specific_fields'), 'thead', 'center'); + $admin->row_span($lang->string('Type-Specific Fields'), 'thead', 'center'); switch ($type) { case 'input_text': - $admin->row_input(lang::p('default_value'), 'defaultvalue', $field['defaultvalue']); - $admin->row_input(lang::p('regex_match'), 'regexmatch', $field['regexmatch']); - $admin->row_input(lang::p('max_length'), 'maxlength', $field['maxlength'], 2, 10); + $admin->row_input($lang->string('Default Value'), 'defaultvalue', $field['defaultvalue']); + $admin->row_input($lang->string('Regular Expression Match'), 'regexmatch', $field['regexmatch']); + $admin->row_input($lang->string('Maximum Length'), 'maxlength', $field['maxlength'], 2, 10); break; case 'input_checkbox': - $admin->row_yesno(lang::p('checked_by_default'), 'defaultvalue', $field['defaultvalue']); + $admin->row_yesno($lang->string('Checked By Default'), 'defaultvalue', $field['defaultvalue']); break; case 'select_single': - $admin->row_textarea(lang::p('selection_values'), 'selects', stripslashes(implode("\n", unserialize($field['selects'])))); - $admin->row_yesno(lang::p('make_first_option_default'), 'usedefault', $field['usedefault']); + $admin->row_textarea($lang->string('Selection Values'), 'selects', stripslashes(implode("\n", unserialize($field['selects'])))); + $admin->row_yesno($lang->string('Make the First Option Default'), 'usedefault', $field['usedefault']); break; } // end table - $admin->row_submit((($edit) ? '[' . lang::p('delete_field') . ']' : '')); + $admin->row_submit((($edit) ? '[' . $lang->string('Delete Field') . ']' : '')); $admin->table_end(); $admin->form_end(); } @@ -260,11 +260,11 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { - $admin->page_start(lang::p('additional_bug_fields')); + $admin->page_start($lang->string('Additional Bug Fields')); $admin->table_start(); - $admin->table_head(lang::p('additional_bug_fields'), 3); - $admin->table_column_head(array(lang::p('display_name_description'), lang::p('field_id'), lang::p('actions'))); + $admin->table_head($lang->string('Additional Bug Fields'), 3); + $admin->table_column_head(array($lang->string('Display Name/Description'), $lang->string('Field ID'), $lang->string('Actions'))); $fields = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield ORDER BY fieldid ASC"); while ($field = $db->fetch_array($fields)) @@ -273,12 +273,12 @@ if ($_REQUEST['do'] == 'modify') array( "$field[name]
$field[description]
" => 'l', "(fieldid: $field[fieldid])" => 'c', - "[" . lang::p('edit') . "] [" . lang::p('delete') . "]" => 'c' + "[" . $lang->string('Edit') . "] [" . $lang->string('Delete') . "]" => 'c' ) ); } - $admin->row_span('[' . lang::p('add_new_field') . ']', 'tfoot', 'center', 3); + $admin->row_span('[' . $lang->string('Add New Bug Field') . ']', 'tfoot', 'center', 3); $admin->table_end(); $admin->page_end(); diff --git a/admin/global.php b/admin/global.php index 946dcb1..e97aad3 100755 --- a/admin/global.php +++ b/admin/global.php @@ -19,28 +19,28 @@ require_once('./includes/functions.php'); // admin navigation $globalnav = array( - lang::p('admin_locations') => array( - lang::p('home') => 'index.php', - lang::p('logout') => '../login.php?do=cplogout' + $lang->string('Administration Locations') => array( + $lang->string('Home') => 'index.php', + $lang->string('Logout') => '../login.php?do=cplogout' ), - lang::p('options') => array( - lang::p('bugstrike_settings') => 'setting.php', - //'Manage Languages' => 'language.php' + $lang->string('Options') => array( + $lang->string('BugStrike Settings') => 'setting.php', + $lang->string('Manage Languages') => 'language.php' ), - lang::p('bug_fields') => array( - lang::p('producs_versions_components') => 'product.php', - lang::p('priorities') => 'priority.php', - lang::p('resolutions') => 'resolution.php', - lang::p('severities') => 'severity.php', - lang::p('statuses') => 'status.php', - lang::p('custom_bug_fields') => 'field.php', - lang::p('automatic_actions') => 'autoaction.php' + $lang->string('Bug Fields') => array( + $lang->string('Products / Versions / Components') => 'product.php', + $lang->string('Priorities') => 'priority.php', + $lang->string('Resolutions') => 'resolution.php', + $lang->string('Severities') => 'severity.php', + $lang->string('Statuses') => 'status.php', + $lang->string('Custom Bug Fields') => 'field.php', + $lang->string('Automatic Actions') => 'autoaction.php' ), - lang::p('user_management') => array( - lang::p('usergroups') => 'usergroup.php' + $lang->string('User Management') => array( + $lang->string('Usergroups') => 'usergroup.php' ) ); @@ -60,10 +60,10 @@ function admin_login() $admin->form_start('../login.php', 'cplogin', false, 'cplogin'); $admin->table_start(true, '425'); - $admin->table_head(lang::p('bugstrike_login')); - $admin->row_input(lang::p('email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle'); - $admin->row_input(lang::p('password'), 'password', '', 2, 35, false, true, 'middle'); - $admin->row_submit('', lang::p('login')); + $admin->table_head($bugsys->lang->string('Login to BugStrike')); + $admin->row_input($bugsys->lang->string('Email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle'); + $admin->row_input($bugsys->lang->string('Password'), 'password', '', 2, 35, false, true, 'middle'); + $admin->row_submit('', $bugsys->lang->string('Login')); $admin->table_end(); $admin->form_end(); @@ -81,7 +81,7 @@ if ($_COOKIE[COOKIE_PREFIX . 'adminsession']) if (md5(md5($bugsys->userinfo['authkey']) . md5($bugsys->userinfo['email']) . md5($bugsys->userinfo['userid'])) != $_COOKIE[COOKIE_PREFIX . 'adminsession']) { $funct->cookie(COOKIE_PREFIX . 'adminsession', ''); - $admin->error(lang::p('invalid_admin_session_terminated')); + $admin->error($lang->string('Invalid admin session has been terminated.')); } else { diff --git a/admin/index.php b/admin/index.php index 7967be5..8aba3fe 100755 --- a/admin/index.php +++ b/admin/index.php @@ -15,7 +15,7 @@ require_once('./global.php'); $admin->page_start('Index'); $admin->table_start(true, '25%'); -$admin->table_head(lang::p('admin_menu')); +$admin->table_head($lang->string('BugStrike Administration Menu')); $navdata = '