diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 9b324034ab84b39346a34a22a68ae5f243f942aa..4904163ec38452c570d708ab2138676d4f52abe3 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -251,8 +251,8 @@ class TicketsAjaxAPI extends AjaxController { $uid = md5($_SERVER['QUERY_STRING']); $_SESSION["adv_$uid"] = $tickets; $result['success'] = sprintf(__("Search criteria matched %s"), - sprintf(_N('%d ticket', '%d tickets', count($tickets), - $tickets))) + sprintf(_N('%d ticket', '%d tickets'), count($tickets), + $tickets)) . " - <a href='tickets.php?advsid=$uid'>".__('view')."</a>"; } else { $result['fail']=__('No tickets found matching your search criteria.'); @@ -332,7 +332,7 @@ class TicketsAjaxAPI extends AjaxController { global $thisstaff; if(!$thisstaff || !($ticket=Ticket::lookup($tid)) || !$ticket->checkStaffAccess($thisstaff)) - Http::response(404, _('No such ticket')); + Http::response(404, __('No such ticket')); ob_start(); $resp = ob_get_contents(); diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index f56f65dd60d66e50257cc948a4f5e80e7fcb4410..45fc398c3a617a713c3f50010ef6b567bd509c3e 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -1238,7 +1238,7 @@ class SelectionField extends FormField { if ($this->value && !isset($this->_choices[$this->value])) { $v = DynamicListItem::lookup($this->value); $this->_choices[$v->get('id')] = $v->get('value') - . mb_convert_encoding(__(' (Disabled)'), MB_CASE_TITLE); + . ' ' . __('(disabled)'); } } return $this->_choices; diff --git a/include/class.forms.php b/include/class.forms.php index a804786204559fd0f79b7c96e4d1093d5e8731c8..98e7e7ea92c5adfa3b2fc1ea1141b51bd76be566 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -1084,12 +1084,13 @@ class ChoicesWidget extends Widget { $have_def = isset($choices[$def_key]); if (!$have_def) $def_val = ($config['prompt']) - ? $config['prompt'] : 'Select'; + ? $config['prompt'] : __('Select' + /* Used as a default prompt for a custom drop-down list */); else $def_val = $choices[$def_key]; } else { $def_val = ($config['prompt']) - ? $config['prompt'] : 'Select'; + ? $config['prompt'] : __('Select'); } $value = $this->value; if ($value === null && $have_def) diff --git a/include/class.page.php b/include/class.page.php index 88d91d2cd04b4f6b71226d581dfe22004747a1df..c533617d6126b04668d5927bf43cacf875c34cb8 100644 --- a/include/class.page.php +++ b/include/class.page.php @@ -269,7 +269,7 @@ class Page { } else { $sql='INSERT INTO '.PAGE_TABLE.' SET '.$sql.', created=NOW()'; if (!db_query($sql) || !($id=db_insert_id())) { - $errors['err']=sprintf(_('Unable to create %s.'), __('this site page')) + $errors['err']=sprintf(__('Unable to create %s.'), __('this site page')) .' '.__('Internal error occurred'); return false; } diff --git a/include/class.setup.php b/include/class.setup.php index 98471d21a3b31373de96c54275f5a82dc9f7c8db..fe70fc10b10f8688e9eabbeab0944aa27e3379f5 100644 --- a/include/class.setup.php +++ b/include/class.setup.php @@ -30,7 +30,7 @@ Class SetupWizard { function SetupWizard(){ $this->errors=array(); - $this->version_verbose = sprintf(_('osTicket %s' /* <%s> is for the version */), + $this->version_verbose = sprintf(__('osTicket %s' /* <%s> is for the version */), THIS_VERSION); } diff --git a/include/class.sla.php b/include/class.sla.php index 81e897cc7a1e8149fe6b020077e46b830d597f06..9b3933a53e8061d91abc5589d7861c7b50baa837 100644 --- a/include/class.sla.php +++ b/include/class.sla.php @@ -137,7 +137,8 @@ class SLA { $sql='SELECT id, name, isactive, grace_period FROM '.SLA_TABLE.' ORDER BY name'; if(($res=db_query($sql)) && db_num_rows($res)) { while($row=db_fetch_array($res)) - $slas[$row['id']] = sprintf('%s (%d hrs - %s)', + $slas[$row['id']] = sprintf(__('%s (%d hours - %s)' + /* Tokens are <name> (<#> hours - <Active|Disabled>) */), $row['name'], $row['grace_period'], $row['isactive']?'Active':'Disabled'); diff --git a/include/class.topic.php b/include/class.topic.php index bfc1df37f3f710b2891ae8f906b382350ba50916..a334e3b543ab0084f79f64d4bfb512bee0687803 100644 --- a/include/class.topic.php +++ b/include/class.topic.php @@ -268,7 +268,7 @@ class Topic { if (!$disabled && $info['disabled']) continue; if ($disabled === self::DISPLAY_DISABLED && $info['disabled']) - $n .= " — (disabled)"; + $n .= " — ".__("(disabled)"); $requested_names[$id] = $n; } diff --git a/include/staff/email.inc.php b/include/staff/email.inc.php index 37d40b0dfe24f860466b88c8be0cff49d0e93cf1..9d2e3f89c566b28d2df5eae293b548de28732bf0 100644 --- a/include/staff/email.inc.php +++ b/include/staff/email.inc.php @@ -215,11 +215,11 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </span> </td> </tr> - <tr><td><?php echo _('Mail Box Protocol'); ?></td> + <tr><td><?php echo __('Mail Box Protocol'); ?></td> <td> <span> <select name="mail_proto"> - <option value=''>— <?php __('Select Protocol'); ?> —</option> + <option value=''>— <?php __('Select protocol'); ?> —</option> <?php foreach (MailFetcher::getSupportedProtos() as $proto=>$desc) { ?> <option value="<?php echo $proto; ?>" <?php @@ -236,7 +236,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <tr><td><?php echo __('Fetch Frequency'); ?></td> <td> <span> - <input type="text" name="mail_fetchfreq" size=4 value="<?php echo $info['mail_fetchfreq']?$info['mail_fetchfreq']:''; ?>"> minutes + <input type="text" name="mail_fetchfreq" size=4 value="<?php echo $info['mail_fetchfreq']?$info['mail_fetchfreq']:''; ?>"> <?php echo __('minutes'); ?> <i class="help-tip icon-question-sign" href="#fetch_frequency"></i> <font class="error"> <?php echo $errors['mail_fetchfreq']; ?></font> </span> diff --git a/include/staff/filter.inc.php b/include/staff/filter.inc.php index 40802ec3b384d734d006afb5cdb9e11b08dffc09..76e75fb49f2a0c724463cabef2fc86a79dd32632 100644 --- a/include/staff/filter.inc.php +++ b/include/staff/filter.inc.php @@ -87,7 +87,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); } $sql='SELECT email_id,email,name FROM '.EMAIL_TABLE.' email ORDER by name'; if(($res=db_query($sql)) && db_num_rows($res)) { - echo '<OPTGROUP label="Specific System Email">'; + echo sprintf('<OPTGROUP label="%s">', __('System Emails')); while(list($id,$email,$name)=db_fetch_row($res)) { $selected=($info['email_id'] && $id==$info['email_id'])?'selected="selected"':''; if($name) @@ -218,7 +218,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ? 'selected="selected"' : ''; if (!$isenabled) - $title .= _(' (disabled)'); + $title .= ' ' . __('(disabled)'); echo sprintf('<option value="%d" %s>%s</option>', $id, $selected, $title); diff --git a/include/staff/helptopic.inc.php b/include/staff/helptopic.inc.php index 67a6bb8959d4b22a17254a198bcc35c3447ca809..91ea1d9ccecc713a32ac9c916b84ac8f5e95029e 100644 --- a/include/staff/helptopic.inc.php +++ b/include/staff/helptopic.inc.php @@ -219,7 +219,7 @@ if ($info['form_id'] == Topic::FORM_USE_PARENT) echo 'selected="selected"'; $selected = ($info['assign']==$k || $info['team_id']==$id)?'selected="selected"':''; if (!$isenabled) - $name .= ' '.mb_convert_encoding(__('(disabled)'), MB_CASE_TITLE); + $name .= ' '.__('(disabled)'); ?> <option value="<?php echo $k; ?>"<?php echo $selected; ?>><?php echo $name; ?></option> <?php diff --git a/include/staff/staff.inc.php b/include/staff/staff.inc.php index ac46767ab3e0cb764546d7169608e51fc036d413..8b73bb557a8d401b200a4e47b78cd237afe6bbb6 100644 --- a/include/staff/staff.inc.php +++ b/include/staff/staff.inc.php @@ -133,7 +133,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </th> </tr> <tr> - <td><?php echo _('Authentication Backend'); ?></td> + <td><?php echo __('Authentication Backend'); ?></td> <td> <select name="backend" id="backend-selection" onchange="javascript: if (this.value != '' && this.value != 'local') @@ -141,7 +141,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); else if (!$('#welcome-email').is(':checked')) $('#password-fields').show(); "> - <option value="">— <?php echo ('Use any available backend'); ?> —</option> + <option value="">— <?php echo __('Use any available backend'); ?> —</option> <?php foreach (StaffAuthenticationBackend::allRegistered() as $ab) { if (!$ab->supportsInteractiveAuthentication()) continue; ?> <option value="<?php echo $ab::$id; ?>" <?php @@ -240,7 +240,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); if(($res=db_query($sql)) && db_num_rows($res)){ while(list($id,$name,$isactive)=db_fetch_row($res)){ $sel=($info['group_id']==$id)?'selected="selected"':''; - echo sprintf('<option value="%d" %s>%s %s</option>',$id,$sel,$name,($isactive?'':' (Disabled)')); + echo sprintf('<option value="%d" %s>%s %s</option>',$id,$sel,$name,($isactive?'':__('(disabled)'))); } } ?> @@ -344,7 +344,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); while(list($id,$name,$isactive)=db_fetch_row($res)){ $checked=($info['teams'] && in_array($id,$info['teams']))?'checked="checked"':''; echo sprintf('<tr><td colspan=2><input type="checkbox" name="teams[]" value="%d" %s>%s %s</td></tr>', - $id,$checked,$name,($isactive?'':' (Disabled)')); + $id,$checked,$name,($isactive?'':__('(disabled)'))); } } ?> <tr> diff --git a/setup/cli/modules/i18n.php b/setup/cli/modules/i18n.php index dfa00cc711ca7f512a01585a4d738a08b52a925e..e43bbee7ef1dee84467eb4d7b83bc79509f9d481 100644 --- a/setup/cli/modules/i18n.php +++ b/setup/cli/modules/i18n.php @@ -275,6 +275,11 @@ class i18n_Compiler extends Module { } $args['forms'][] = $string['form']; } + elseif ($string) { + $this->stderr->write(sprintf("%s: %s: Too many arguments\n", + $string['line'] ?: '?', $string['form'])); + } + // Add usage and comment info if (!isset($args['line']) && isset($string['line'])) $args['line'] = $string['line']; @@ -432,6 +437,8 @@ class i18n_Compiler extends Module { '_NS' => array('forms'=>2), '_P' => array('context'=>1, 'forms'=>1), '_NP' => array('context'=>1, 'forms'=>2), + // This is an error + '_' => array('forms'=>0), ); $files = Test::getAllScripts(); $strings = array();