From dbaf21d4944dd9616c4553a5f8380fa5d3a1fe9d Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 18 Aug 2010 10:36:29 -0300 Subject: Implement gettext() calls on shaper.inc --- etc/inc/shaper.inc | 391 ++++++++++++++++++++++++++--------------------------- 1 file changed, 194 insertions(+), 197 deletions(-) (limited to 'etc/inc/shaper.inc') diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc index 7d95f82..7f4b644 100644 --- a/etc/inc/shaper.inc +++ b/etc/inc/shaper.inc @@ -184,13 +184,13 @@ function shaper_do_input_validation($postdata, $reqdfields, $reqdfieldsn, $input /* check for bad control characters */ foreach ($postdata as $pn => $pd) { if (is_string($pd) && preg_match("/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/", $pd)) { - $input_errors[] = "The field '" . $pn . "' contains invalid characters."; + $input_errors[] = sprintf(gettext("The field '%s' contains invalid characters."), $pn); } } for ($i = 0; $i < count($reqdfields); $i++) { if ($postdata[$reqdfields[$i]] == "") { - $input_errors[] = "The field '" . $reqdfieldsn[$i] . "' is required."; + $input_errors[] = sprintf(gettext("The field '%s' is required."), $reqdfieldsn[$i]); } } } @@ -309,24 +309,24 @@ class altq_root_queue { function validate_input($data, &$input_errors) { $reqdfields[] = "bandwidth"; - $reqdfieldsn[] = "Bandwidth"; + $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; - $reqdfieldsn[] = "Bandwidthtype"; + $reqdfieldsn[] = gettext("Bandwidthtype"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['bandwidth'] && (!is_numeric($data['bandwidth']))) - $input_errors[] = "Bandwidth must be an integer."; + $input_errors[] = gettext("Bandwidth must be an integer."); if ($data['bandwidth'] < 0) - $input_errors[] = "Bandwidth cannot be negative."; + $input_errors[] = gettext("Bandwidth cannot be negative."); if ($data['qlimit'] && (!is_numeric($data['qlimit']))) - $input_errors[] = "Qlimit must be an integer."; + $input_errors[] = gettext("Qlimit must be an integer."); if ($data['qlimit'] < 0) - $input_errors[] = "Qlimit must be an positive."; + $input_errors[] = gettext("Qlimit must be an positive."); if ($data['tbrconfig'] && (!is_numeric($data['tbrconfig']))) - $input_errors[] = "Tbrsize must be an integer."; + $input_errors[] = gettext("Tbrsize must be an integer."); if ($data['tbrconfig'] < 0) - $input_errors[] = "Tbrsize must be an positive."; + $input_errors[] = gettext("Tbrsize must be an positive."); } /* Implement this to shorten some code on the frontend page */ @@ -597,18 +597,18 @@ class altq_root_queue { */ function build_form() { $form = "
"; - $form .= "Enable/Disable"; + $form .= gettext("Enable/Disable"); $form .= "
"; $form .= " GetEnabled() == "on") $form .= " CHECKED"; - $form .= " > Enable/disable discipline and its children"; + $form .= " > " . gettext("Enable/disable discipline and its children") . ""; $form .= ""; - $form .= "
Name"; + $form .= "
" . gettext("Name") . ""; $form .= ""; $form .= "".$this->GetQname().""; $form .= ""; - $form .= "Scheduler Type "; + $form .= "" . gettext("Scheduler Type "); $form .= ""; $form .= ""; $form .= ""; $form .= "
"; - $form .= "NOTE: Changing this changes all child queues!"; - $form .= " Beware you can lose information."; + $form .= gettext("NOTE: Changing this changes all child queues!"); + $form .= gettext(" Beware you can lose information."); $form .= ""; $form .= ""; - $form .= "Bandwidth"; + $form .= "" . gettext("Bandwidth"); $form .= ""; $form .= "GetBandwidth() . "\">"; @@ -669,9 +669,9 @@ class altq_root_queue { $form .= $this->GetTbrConfig(); $form .= "\">"; $form .= "
"; - $form .= "Adjusts the size, in bytes, of the token bucket regulator. "; - $form .= "If not specified, heuristics based on the interface "; - $form .= "bandwidth are used to determine the size."; + $form .= gettext("Adjusts the size, in bytes, of the token bucket regulator. " + . "If not specified, heuristics based on the interface " + . "bandwidth are used to determine the size."); $form .= ""; $form .= "GetInterface() . "\">"; @@ -938,19 +938,19 @@ class priq_queue { function validate_input($data, &$input_errors) { $reqdfields[] = "name"; - $reqdfieldsn[] = "Name"; + $reqdfieldsn[] = gettext("Name"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['priority'] && (!is_numeric($data['priority']) || ($data['priority'] < 1) || ($data['priority'] > 15))) { - $input_errors[] = "The priority must be an integer between 1 and 15."; + $input_errors[] = gettext("The priority must be an integer between 1 and 15."); } if ($data['qlimit'] && (!is_numeric($data['qlimit']))) - $input_errors[] = "Queue limit must be an integer"; + $input_errors[] = gettext("Queue limit must be an integer"); if ($data['qlimit'] < 0) - $input_errors[] = "Queue limit must be positive"; + $input_errors[] = gettext("Queue limit must be positive"); if (!preg_match("/^[a-zA-Z0-9_-]*$/", $data['name'])) - $input_errors[] = "Queue names must be alphanumeric and _ or - only."; + $input_errors[] = gettext("Queue names must be alphanumeric and _ or - only."); } @@ -1077,12 +1077,12 @@ class priq_queue { */ function build_form() { $form = "
"; - $form .= "Enable/Disable"; + $form .= gettext("Enable/Disable"); $form .= "
"; $form .= " GetEnabled() == "on") $form .= " CHECKED"; - $form .= " > Enable/Disable queue and its children"; + $form .= " > " . gettext("Enable/Disable queue and its children") . ""; $form .= ""; $form .= ""; $form .= ""; @@ -1090,51 +1090,51 @@ class priq_queue { $form .= "GetQname()); $form .= "\">"; - $form .= "
Enter the name of the queue here. Do not use spaces and limit the size to 15 characters."; + $form .= "
" . gettext("Enter the name of the queue here. Do not use spaces and limit the size to 15 characters."); $form .= "
"; $form .= ""; $form .= "Priority"; $form .= " GetQpriority()); $form .= "\">"; - $form .= "
For hfsc, the range is 0 to 7. The default is 1. Hfsc queues with a higher priority are preferred in the case of overload."; + $form .= "
" . gettext("For hfsc, the range is 0 to 7. The default is 1. Hfsc queues with a higher priority are preferred in the case of overload.") . ""; $form .= ""; $form .= ""; - $form .= "Queue limit"; + $form .= "" . gettext("Queue limit") . ""; $form .= " GetQlimit()); $form .= "\">"; - $form .= "
Queue limit in packets per second."; + $form .= "
" . gettext("Queue limit in packets per second."); $form .= ""; $form .= ""; - $form .= "Scheduler options"; + $form .= "" . gettext("Scheduler options") . ""; $form .= ""; $tmpvalue = $this->GetDefault(); if (!empty($tmpvalue)) { $form .= ""; } else { $form .= ""; } $form .= "GetRed(); if(!empty($tmpvalue)) $form .= " CHECKED"; - $form .= "> Random Early Detection
"; + $form .= "> " . gettext("Random Early Detection") . "
"; $form .= "GetRio(); if(!empty($tmpvalue)) $form .= " CHECKED"; - $form .= "> Random Early Detection In and Out
"; + $form .= "> " . gettext("Random Early Detection In and Out") . "
"; $form .= "GetEcn(); if(!empty($tmpvalue)) $form .= " CHECKED"; - $form .= "> Explicit Congestion Notification
"; - $form .= "
Select options for this queue"; + $form .= "> " . gettext("Explicit Congestion Notification") . "
"; + $form .= "
" . gettext("Select options for this queue"); $form .= ""; - $form .= "Description"; + $form .= "" . gettext("Description") . ""; $form .= ""; $form .= "GetDescription() . "\" >"; $form .= ""; @@ -1160,23 +1160,23 @@ class priq_queue { */ $form .= ""; $form .= ""; - $form .= "Bandwidth: " . $this->GetBandwidth().$this->GetBwscale(); + $form .= gettext("Bandwidth:") . " " . $this->GetBandwidth().$this->GetBwscale(); $form .= ""; $form .= ""; $tmpvalue = $this->GetQpriority(); if (!empty($tmpvalue)) - $form .= "Priority: on "; + $form .= gettext("Priority: on") . " "; $tmpvalue = $this->GetDefault(); if (!empty($tmpvalue)) - $form .= "Default: on "; + $form .= "" . gettext("Default: on") . " "; $form .= ""; $form .= "GetInterface() . "&queue="; $form .= $this->GetQname() . "&action=delete\">"; $form .= ""; - $form .= "Delete queue from interface"; + $form .= " width=\"17\" height=\"17\" border=\"0\" title=\"" . gettext("Delete queue from interface") . "\">"; + $form .= "" . gettext("Delete queue from interface") . ""; return $form; @@ -1499,22 +1499,22 @@ class hfsc_queue extends priq_queue { parent::validate_input($data, $input_errors); $reqdfields[] = "bandwidth"; - $reqdfieldsn[] = "Bandwidth"; + $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; - $reqdfieldsn[] = "Bandwidthtype"; + $reqdfieldsn[] = gettext("Bandwidthtype"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if (isset($data['linkshare3']) && $data['linkshare3'] <> "") { if ($data['bandwidth'] && (!is_numeric($data['bandwidth']))) - $input_errors[] = "Bandwidth must be an integer."; + $input_errors[] = gettext("Bandwidth must be an integer."); - if ($data['bandwidth'] < 0) - $input_errors[] = "Bandwidth cannot be negative."; + if ($data['bandwidth'] < 0) + $input_errors[] = gettext("Bandwidth cannot be negative."); if ($data['bandwidthtype'] == "%") { if ($data['bandwidth'] > 100 || $data['bandwidth'] < 0) - $input_errors[] = "Bandwidth in percentage should be between 1 and 100 bounds."; + $input_errors[] = gettext("Bandwidth in percentage should be between 1 and 100 bounds."); } /* $parent =& $this->GetParent(); @@ -1531,15 +1531,15 @@ class hfsc_queue extends priq_queue { } if ($data['upperlimit1'] <> "" && $data['upperlimit2'] == "") - $input_errors[] = ("upperlimit service curve defined but missing (d) value"); + $input_errors[] = gettext("upperlimit service curve defined but missing (d) value"); if ($data['upperlimit2'] <> "" && $data['upperlimit1'] == "") - $input_errors[] = ("upperlimit service curve defined but missing initial bandwidth (m1) value"); + $input_errors[] = gettext("upperlimit service curve defined but missing initial bandwidth (m1) value"); if ($data['upperlimit1'] <> "" && !is_valid_shaperbw($data['upperlimit1'])) - $input_errors[] = ("upperlimit m1 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("upperlimit m1 value needs to be Kb, Mb, Gb, or %"); if ($data['upperlimit2'] <> "" && !is_numeric($data['upperlimit2'])) - $input_errors[] = ("upperlimit d value needs to be numeric"); + $input_errors[] = gettext("upperlimit d value needs to be numeric"); if ($data['upperlimit3'] <> "" && !is_valid_shaperbw($data['upperlimit3'])) - $input_errors[] = ("upperlimit m2 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("upperlimit m2 value needs to be Kb, Mb, Gb, or %"); /* if (isset($data['upperlimit']) && $data['upperlimit3'] <> "" && $data['upperlimit1'] <> "") { @@ -1553,19 +1553,19 @@ class hfsc_queue extends priq_queue { } */ if ($data['linkshare1'] <> "" && $data['linkshare2'] == "") - $input_errors[] = ("linkshare service curve defined but missing (d) value"); + $input_errors[] = gettext("linkshare service curve defined but missing (d) value"); if ($data['linkshare2'] <> "" && $data['linkshare1'] == "") - $input_errors[] = ("linkshare service curve defined but missing initial bandwidth (m1) value"); + $input_errors[] = gettext("linkshare service curve defined but missing initial bandwidth (m1) value"); if ($data['linkshare1'] <> "" && !is_valid_shaperbw($data['linkshare1'])) - $input_errors[] = ("linkshare m1 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("linkshare m1 value needs to be Kb, Mb, Gb, or %"); if ($data['linkshare2'] <> "" && !is_numeric($data['linkshare2'])) - $input_errors[] = ("linkshare d value needs to be numeric"); + $input_errors[] = gettext("linkshare d value needs to be numeric"); if ($data['linkshare3'] <> "" && !is_valid_shaperbw($data['linkshare3'])) - $input_errors[] = ("linkshare m2 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("linkshare m2 value needs to be Kb, Mb, Gb, or %"); if ($data['realtime1'] <> "" && $data['realtime2'] == "") - $input_errors[] = ("realtime service curve defined but missing (d) value"); + $input_errors[] = gettext("realtime service curve defined but missing (d) value"); if ($data['realtime2'] <> "" && $data['realtime1'] == "") - $input_errors[] = ("realtime service curve defined but missing initial bandwidth (m1) value"); + $input_errors[] = gettext("realtime service curve defined but missing initial bandwidth (m1) value"); /* if (isset($data['linkshare']) && $data['linkshare3'] <> "" && $data['linkshare1'] <> "" && 0) { @@ -1580,11 +1580,11 @@ class hfsc_queue extends priq_queue { */ if ($data['realtime1'] <> "" && !is_valid_shaperbw($data['realtime1'])) - $input_errors[] = ("realtime m1 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("realtime m1 value needs to be Kb, Mb, Gb, or %"); if ($data['realtime2'] <> "" && !is_numeric($data['realtime2'])) - $input_errors[] = ("realtime d value needs to be numeric"); + $input_errors[] = gettext("realtime d value needs to be numeric"); if ($data['realtime3'] <> "" && !is_valid_shaperbw($data['realtime3'])) - $input_errors[] = ("realtime m2 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("realtime m2 value needs to be Kb, Mb, Gb, or %"); /* if (isset($data['realtime']) && $data['realtime3'] <> "" && $data['realtime1'] <> "" && 0) { @@ -1805,7 +1805,7 @@ class hfsc_queue extends priq_queue { function build_form() { $form = parent::build_form(); $form .= ""; - $form .= "Bandwidth"; + $form .= "" . gettext("Bandwidth") . ""; $form .= " GetBandwidth()); $form .= "\">"; @@ -1831,10 +1831,10 @@ class hfsc_queue extends priq_queue { $form .= " selected=\"yes\""; $form .= ">%"; $form .= "
"; - $form .= "Choose the amount of bandwidth for this queue"; + $form .= "" . gettext("Choose the amount of bandwidth for this queue"); $form .= ""; $form .= ""; - $form .= "Service Curve (sc)"; + $form .= "" . gettext("Service Curve (sc)") . ""; $form .= ""; $form .= ""; $form .= ""; @@ -1856,7 +1856,7 @@ class hfsc_queue extends priq_queue { $form .= "\" id=\"upperlimit3\" name=\"upperlimit3\" "; if ($this->GetUpperlimit() == "") $form .= " disabled"; - $form .= ">"; + $form .= ">"; $form .= ""; + $form .= ">"; $form .= ""; + $form .= ">"; $form .= "
 
m1
d
m2
The maximum allowed bandwidth for the queue.
" . gettext("The maximum allowed bandwidth for the queue.") . "
GetRealtime() <> "") $form .= " CHECKED "; @@ -1875,11 +1875,11 @@ class hfsc_queue extends priq_queue { $form .= "\" id=\"realtime3\" name=\"realtime3\" "; if ($this->GetRealtime() == "") $form .= " disabled"; - $form .= ">The minimum required bandwidth for the queue.
" . gettext("The minimum required bandwidth for the queue.") . "
GetLinkshare() <> "") $form .= " CHECKED "; - $form .= "onChange=\"enable_linkshare()\"> Link share: " . gettext("Link share:") . "GetL_m1()); $form .= "\" id=\"linkshare1\" name=\"linkshare1\" "; if ($this->GetLinkshare() == "") @@ -1894,12 +1894,12 @@ class hfsc_queue extends priq_queue { $form .= "\" id=\"linkshare3\" name=\"linkshare3\" "; if ($this->GetLinkshare() == "") $form .= " disabled"; - $form .= ">The bandwidth share of a backlogged queue - this overrides priority.
" . gettext("The bandwidth share of a backlogged queue - this overrides priority.") . "

"; - $form .= "The format for service curve specifications is (m1, d, m2). m2 controls"; - $form .= "the bandwidth assigned to the queue. m1 and d are optional and can be"; - $form .= "used to control the initial bandwidth assignment. For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value"; - $form .= "given in m2."; + $form .= gettext("The format for service curve specifications is (m1, d, m2). m2 controls " + . "the bandwidth assigned to the queue. m1 and d are optional and can be " + . "used to control the initial bandwidth assignment. For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value " + . "given in m2."); $form .= "
"; $form .= ""; @@ -2146,24 +2146,24 @@ class cbq_queue extends priq_queue { parent::validate_input($data, $input_errors); if ($data['priority'] > 7) - $input_errors[] = "Priority must be an integer between 1 and 7."; + $input_errors[] = gettext("Priority must be an integer between 1 and 7."); $reqdfields[] = "bandwidth"; - $reqdfieldsn[] = "Bandwidth"; + $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; - $reqdfieldsn[] = "Bandwidthtype"; + $reqdfieldsn[] = gettext("Bandwidthtype"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['bandwidth'] && !is_numeric($data['bandwidth'])) - $input_errors[] = "Bandwidth must be an integer."; + $input_errors[] = gettext("Bandwidth must be an integer."); if ($data['bandwidth'] < 0) - $input_errors[] = "Bandwidth cannot be negative."; + $input_errors[] = gettext("Bandwidth cannot be negative."); if ($data['bandwidthtype'] == "%") { if ($data['bandwidth'] > 100 || $data['bandwidth'] < 0) - $input_errors[] = "Bandwidth in percentage should be between 1 and 100 bounds."; + $input_errors[] = gettext("Bandwidth in percentage should be between 1 and 100 bounds."); } /* @@ -2281,7 +2281,7 @@ class cbq_queue extends priq_queue { function build_form() { $form = parent::build_form(); $form .= ""; - $form .= "Bandwidth"; + $form .= "" . gettext("Bandwidth") . ""; $form .= " GetBandwidth() > 0) $form .= htmlspecialchars($this->GetBandwidth()); @@ -2308,13 +2308,13 @@ class cbq_queue extends priq_queue { $form .= " selected=\"yes\""; $form .= ">%"; $form .= "
"; - $form .= "Choose the amount of bandwidth for this queue"; + $form .= "" . gettext("Choose the amount of bandwidth for this queue"); $form .= ""; - $form .= "Scheduler specific options"; + $form .= "" . gettext("Scheduler specific options") . ""; $form .= "GetBorrow() == "on") $form .= " CHECKED "; - $form .= "> Borrow from other queues when available
"; + $form .= "> " . gettext("Borrow from other queues when available") . "
"; return $form; } @@ -2421,26 +2421,26 @@ class fairq_queue extends priq_queue { parent::validate_input($data, $input_errors); if ($data['priority'] > 255) - $input_errors[] = "Priority must be an integer between 1 and 255."; + $input_errors[] = gettext("Priority must be an integer between 1 and 255."); $reqdfields[] = "bandwidth"; - $reqdfieldsn[] = "Bandwidth"; + $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; - $reqdfieldsn[] = "Bandwidthtype"; + $reqdfieldsn[] = gettext("Bandwidthtype"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['bandwidth'] && !is_numeric($data['bandwidth'])) - $input_errors[] = "Bandwidth must be an integer."; + $input_errors[] = gettext("Bandwidth must be an integer."); - if ($data['bandwidth'] < 0) - $input_errors[] = "Bandwidth cannot be negative."; + if ($data['bandwidth'] < 0) + $input_errors[] = gettext("Bandwidth cannot be negative."); - if ($data['bandwidthtype'] == "%") { - if ($data['bandwidth'] > 100 || $data['bandwidth'] < 0) - $input_errors[] = "Bandwidth in percentage should be between 1 and 100 bounds."; - } + if ($data['bandwidthtype'] == "%") { + if ($data['bandwidth'] > 100 || $data['bandwidth'] < 0) + $input_errors[] = gettext("Bandwidth in percentage should be between 1 and 100 bounds."); + } /* $parent =& $this->GetParent(); @@ -2548,7 +2548,7 @@ class fairq_queue extends priq_queue { function build_form() { $form = parent::build_form(); $form .= ""; - $form .= "Bandwidth"; + $form .= "" . gettext("Bandwidth") . ""; $form .= " GetBandwidth() > 0) $form .= htmlspecialchars($this->GetBandwidth()); @@ -2575,20 +2575,20 @@ class fairq_queue extends priq_queue { $form .= " selected=\"yes\""; $form .= ">%"; $form .= "
"; - $form .= "Choose the amount of bandwidth for this queue"; + $form .= "" . gettext("Choose the amount of bandwidth for this queue"); $form .= ""; - $form .= "Scheduler specific options"; + $form .= "" . gettext("Scheduler specific options") . ""; $form .= ""; + $form .= "\"> " . gettext("Number of buckets available.") . "
"; $form .= ""; + $form .= "\"> " . gettext("Bandwidth limit for hosts to not saturate link.") . "
"; $form .= "
"; $form .= "GetBuckets()); if(!empty($tmpvalue)) $form .= $this->GetBuckets(); - $form .= "\"> Number of buckets available.
GetHogs()); if(!empty($tmpvalue)) $form .= $this->GetHogs(); - $form .= "\"> Bandwidth limit for hosts to not saturate link.
"; return $form; } @@ -2742,24 +2742,24 @@ class dummynet_class { function validate_input($data, &$input_errors) { $reqdfields[] = "bandwidth"; - $reqdfieldsn[] = "Bandwidth"; + $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; - $reqdfieldsn[] = "Bandwidthtype"; + $reqdfieldsn[] = gettext("Bandwidthtype"); $reqdfields[] = "name"; - $reqdfieldsn[] = "Name"; + $reqdfieldsn[] = gettext("Name"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['plr'] && ((!is_numeric($data['plr'])) || ($data['plr'] <= 0 && $data['plr'] > 1))) - $input_errors[] = "Plr must be an integer between 1 and 100."; + $input_errors[] = gettext("Plr must be an integer between 1 and 100."); if (($data['buckets'] && (!is_numeric($data['buckets']))) || ($data['buckets'] < 1 && $data['buckets'] > 100)) - $input_errors[] = "Buckets must be an integer between 16 and 65535."; + $input_errors[] = gettext("Buckets must be an integer between 16 and 65535."); if ($data['qlimit'] && (!is_numeric($data['qlimit']))) - $input_errors[] = "Queue limit must be an integer"; - if (!preg_match("/^[a-zA-Z0-9_-]+$/", $data['name'])) - $input_errors[] = "Queue names must be alphanumeric and _ or - only."; + $input_errors[] = gettext("Queue limit must be an integer"); + if (!preg_match("/^[a-zA-Z0-9_-]+$/", $data['name'])) + $input_errors[] = gettext("Queue names must be alphanumeric and _ or - only."); } } @@ -2851,10 +2851,10 @@ class dnpipe_class extends dummynet_class { parent::validate_input($data, $input_errors); if ($data['bandwidth'] && (!is_numeric($data['bandwidth']))) - $input_errors[] = "Bandwidth must be an integer."; + $input_errors[] = gettext("Bandwidth must be an integer."); if ($data['delay'] && (!is_numeric($data['delay']))) - $input_errors[] = "Delay must be an integer."; - } + $input_errors[] = gettext("Delay must be an integer."); + } function ReadConfig(&$q) { $this->SetQname($q['name']); @@ -2942,19 +2942,19 @@ class dnpipe_class extends dummynet_class { function build_form() { $form = "
"; - $form .= "Enable/Disable"; + $form .= gettext("Enable/Disable"); $form .= ""; $form .= " GetEnabled() == "on") $form .= " CHECKED"; - $form .= " > Enable/Disable limiter and its children"; + $form .= " > " . gettext("Enable/Disable limiter and its children") . ""; $form .= ""; - $form .= "
Name"; + $form .= "
" . gettext("Name") . ""; $form .= ""; $form .= "GetQname()."\">"; $form .= ""; - $form .= "Bandwidth"; + $form .= "" . gettext("Bandwidth"); $form .= ""; $form .= "GetBandwidth() . "\">"; @@ -2974,10 +2974,10 @@ class dnpipe_class extends dummynet_class { $form .= ""; + $form .= ">" . gettext("Bit/s") . ""; $form .= ""; $form .= ""; - $form .= "Mask"; + $form .= "" . gettext("Mask") . ""; $form .= ""; $form .= ""; $form .= " 
"; - $form .= "If 'source' or 'destination' is chosen, \n"; - $form .= "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n"; - $form .= "be created for each source/destination IP address encountered, \n"; - $form .= "respectively. This makes it possible to easily specify bandwidth \n"; - $form .= "limits per host."; + $form .= "" . gettext("If 'source' or 'destination' is chosen, \n" + . "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n" + . "be created for each source/destination IP address encountered, \n" + . "respectively. This makes it possible to easily specify bandwidth \n" + . "limits per host.") . ""; $form .= ""; - $form .= "Description"; + $form .= "" . gettext("Description") . ""; $form .= ""; $form .= "GetDescription(); $form .= "\">"; $form .= "
"; - $form .= "You may enter a description here "; - $form .= "for your reference (not parsed)."; + $form .= gettext("You may enter a description here for your reference (not parsed).") . "
"; $form .= ""; $form .= ""; $form .= ""; $form .= "
"; $form .= "

"; + $form .= " value=\"" . gettext("Show advanced options") . "\">"; $form .= "

"; $form .= ""; @@ -3021,37 +3020,37 @@ class dnpipe_class extends dummynet_class { $form .= ""; $form .= "GetDelay() . "\">"; - $form .= " ms
Hint: in most cases, you "; - $form .= "should specify 0 here (or leave the field empty)"; + $form .= " ms
" . gettext("Hint: in most cases, you " + . "should specify 0 here (or leave the field empty)") . ""; $form .= "
"; $form .= ""; $form .= "Packet loss rate"; $form .= ""; $form .= "GetPlr() . "\">"; - $form .= " 
Hint: in most cases, you "; - $form .= "should specify 0 here (or leave the field empty)."; - $form .= "A value of 0.001 means one packet in 1000 gets dropped"; + $form .= " 
" . gettext("Hint: in most cases, you " + . "should specify 0 here (or leave the field empty). " + . "A value of 0.001 means one packet in 1000 gets dropped") . ""; $form .= ""; $form .= ""; - $form .= "Queue Size"; + $form .= "" . gettext("Queue Size") . ""; $form .= ""; $form .= "GetQlimit() . "\">"; $form .= " slots
"; - $form .= "Hint: in most cases, you "; - $form .= "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first,"; - $form .= "then they are delayed by value specified in the Delay field, and then they "; - $form .= "are delivered to their destination."; + $form .= "" . gettext("Hint: in most cases, you " + . "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, " + . "then they are delayed by value specified in the Delay field, and then they " + . "are delivered to their destination.") . ""; $form .= ""; $form .= ""; - $form .= "Bucket Size"; + $form .= "" . gettext("Bucket Size") . ""; $form .= ""; $form .= "GetBuckets() . "\">"; $form .= " slots
"; - $form .= "Hint: in most cases, you "; - $form .= "should leave the field empty. It increases the hash size set."; + $form .= "" . gettext("Hint: in most cases, you " + . "should leave the field empty. It increases the hash size set."); $form .= ""; return $form; @@ -3108,7 +3107,7 @@ class dnqueue_class extends dummynet_class { if ($data['weight'] && ((!is_numeric($data['weight'])) || ($data['weight'] < 1 && $data['weight'] > 100))) - $input_errors[] = "Weight must be an integer between 1 and 100."; + $input_errors[] = gettext("Weight must be an integer between 1 and 100."); } /* @@ -3185,40 +3184,40 @@ class dnqueue_class extends dummynet_class { function build_form() { $form = "
"; - $form .= "Enable/Disable"; + $form .= gettext("Enable/Disable"); $form .= ""; $form .= " GetEnabled() == "on") $form .= " CHECKED"; - $form .= " > Enable/Disable queue and its children"; + $form .= " > " . gettext("Enable/Disable queue and its children") . ""; $form .= ""; - $form .= "
Name"; + $form .= "
" . gettext("Name") . ""; $form .= ""; $form .= "GetQname()."\">"; $form .= ""; - $form .= "Mask"; + $form .= "" . gettext("Mask") . ""; $form .= ""; $form .= ""; $form .= " slots
"; - $form .= "If 'source' or 'destination' is chosen, \n"; - $form .= "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n"; - $form .= "be created for each source/destination IP address encountered, \n"; - $form .= "respectively. This makes it possible to easily specify bandwidth \n"; - $form .= "limits per host."; + $form .= "" . gettext("If 'source' or 'destination' is chosen, \n" + . "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n" + . "be created for each source/destination IP address encountered, \n" + . "respectively. This makes it possible to easily specify bandwidth \n" + . "limits per host.") . ""; $form .= ""; $form .= "Description"; $form .= ""; @@ -3226,51 +3225,50 @@ class dnqueue_class extends dummynet_class { $form .= $this->GetDescription(); $form .= "\">"; $form .= "
"; - $form .= "You may enter a description here "; - $form .= "for your reference (not parsed)."; + $form .= gettext("You may enter a description here for your reference (not parsed).") . "
"; $form .= ""; $form .= ""; $form .= ""; $form .= "
"; $form .= "

"; + $form .= " value=\"" . gettext("Show advanced options") . "\">"; $form .= "

"; $form .= ""; - $form .= "Weight"; + $form .= "" . gettext("Weight") . ""; $form .= ""; $form .= "GetWeight() . "\">"; - $form .= " ms
Hint: For queues under the same parent "; - $form .= "this specifies the share that a queue gets(values range from 1 to 100, you can leave it blank otherwise)"; + $form .= " ms
" . gettext("Hint: For queues under the same parent " + . "this specifies the share that a queue gets(values range from 1 to 100, you can leave it blank otherwise)") . ""; $form .= ""; $form .= ""; - $form .= "Packet loss rate"; + $form .= "" . gettext("Packet loss rate") . ""; $form .= ""; $form .= "GetPlr() . "\">"; - $form .= " 
Hint: in most cases, you "; - $form .= "should specify 0 here (or leave the field empty)."; - $form .= "A value of 0.001 means one packet in 1000 gets dropped"; + $form .= " 
" . gettext("Hint: in most cases, you " + . "should specify 0 here (or leave the field empty). " + . "A value of 0.001 means one packet in 1000 gets dropped") . ""; $form .= ""; $form .= ""; - $form .= "Queue Size"; + $form .= "" . gettext("Queue Size") . ""; $form .= ""; $form .= "GetQlimit() . "\">"; $form .= " slots
"; - $form .= "Hint: in most cases, you "; - $form .= "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, "; - $form .= "then they are delayed by value specified in the Delay field, and then they "; - $form .= "are delivered to their destination."; + $form .= "" . gettext("Hint: in most cases, you " + . "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, " + . "then they are delayed by value specified in the Delay field, and then they " + . "are delivered to their destination.") . ""; $form .= ""; $form .= ""; - $form .= "Bucket Size"; + $form .= "" . gettext("Bucket Size") . ""; $form .= ""; $form .= "GetBuckets() . "\">"; - $form .= " slots
"; - $form .= "Hint: in most cases, you "; - $form .= "should leave the field empty. It increases the hash size set."; + $form .= " " . gettext("slots") . "
"; + $form .= "" . gettext("Hint: in most cases, you " + . "should leave the field empty. It increases the hash size set."); $form .= ""; $form .= "
"; - $form .= "Enable/Disable"; + $form .= gettext("Enable/Disable"); $form .= ""; $form .= " GetREnabled() == "on") { $form .= "checked = \"CHECKED\""; } - $form .= " > Enable/Disable layer7 Container"; + $form .= " > " . gettext("Enable/Disable layer7 Container") . ""; $form .= ""; - $form .= "
Name"; + $form .= "
" . gettext("Name") . ""; $form .= ""; $form .= "GetRName()."\">"; $form .= ""; - $form .= "Description"; + $form .= "" . gettext("Description") . ""; $form .= ""; $form .= "GetRDescription(); $form .= "\">"; $form .= "
"; - $form .= "You may enter a description here "; - $form .= "for your reference (not parsed)."; + $form .= gettext("You may enter a description here for your reference (not parsed).") . "
"; $form .= ""; return $form; @@ -3484,12 +3481,12 @@ class layer7 { function validate_input($data, &$input_errors) { $reqdfields[] = "container"; - $reqdfieldsn[] = "Name"; + $reqdfieldsn[] = gettext("Name"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if (!preg_match("/^[a-zA-Z0-9_-]+$/", $data['container'])) - $input_errors[] = "Queue names must be alphanumeric and _ or - only."; + $input_errors[] = gettext("Queue names must be alphanumeric and _ or - only."); } function delete_l7c() { @@ -3966,31 +3963,31 @@ function build_iface_without_this_queue($iface, $qname) { $scheduler = ": " . $altq->GetScheduler(); $form = ""; $form .= "".$iface.": ".$scheduler.""; - $form .= ""; - $form .= ""; - $form .= ""; - $form .= ""; - $form .= " Clone shaper/queue on this interface"; + $form .= ""; + $form .= ""; + $form .= ""; + $form .= ""; + $form .= gettext(" Clone shaper/queue on this interface") . ""; - return $form; + return $form; } $default_shaper_msg = ""; -$default_shaper_msg .= "

Welcome to the {$g['product_name']} Traffic Shaper.
"; -$default_shaper_msg .= "The tree on the left helps you navigate through the queues
"; -$default_shaper_msg .= "buttons at the bottom represent queue actions and are activated accordingly."; +$default_shaper_msg .= "

" . sprintf(gettext("Welcome to the %s Traffic Shaper."), $g['product_name']) . "
"; +$default_shaper_msg .= gettext("The tree on the left helps you navigate through the queues
" + . "buttons at the bottom represent queue actions and are activated accordingly."); $default_shaper_msg .= "

"; $default_shaper_msg .= ""; $dn_default_shaper_msg = ""; -$dn_default_shaper_msg .= "

Welcome to the {$g['product_name']} Traffic Shaper.
"; -$dn_default_shaper_msg .= "The tree on the left helps you navigate through the queues
"; -$dn_default_shaper_msg .= "buttons at the bottom represent queue actions and are activated accordingly."; +$dn_default_shaper_msg .= "

" . sprintf(gettext("Welcome to the %s Traffic Shaper."), $g['product_name']) . "
"; +$dn_default_shaper_msg .= gettext("The tree on the left helps you navigate through the queues
" + . "buttons at the bottom represent queue actions and are activated accordingly."); $dn_default_shaper_msg .= "

"; $dn_default_shaper_msg .= ""; -- cgit v1.1