From 241489397900c0556fc06ad3931441513e62ece8 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Thu, 24 Jun 2010 12:24:40 -0300 Subject: Implement gettext() calls --- usr/local/www/firewall_aliases_edit.php | 70 ++++++++++++++++----------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php index dca3d12..a7e50b6 100755 --- a/usr/local/www/firewall_aliases_edit.php +++ b/usr/local/www/firewall_aliases_edit.php @@ -44,7 +44,7 @@ ##|*MATCH=firewall_aliases_edit.php* ##|-PRIV -$pgtitle = array("Firewall","Aliases","Edit"); +$pgtitle = array(gettext("Firewall"),gettext("Aliases"),gettext("Edit")); // Keywords not allowed in names $reserved_keywords = array("pass", "out", "queue", "max", "min", "pptp", "pppoe", "l2tp", "openvpn"); @@ -101,7 +101,7 @@ if (isset($id) && $a_aliases[$id]) { $iflist = get_configured_interface_with_descr(true, true); foreach ($iflist as $if => $ifdesc) if($ifdesc == $pconfig['descr']) - $input_errors[] = "Sorry, an interface is already named {$pconfig['descr']}."; + $input_errors[] = sprintf(gettext("Sorry, an interface is already named %s."), $pconfig['descr']); if($a_aliases[$id]['type'] == "urltable") { $pconfig['address'] = $a_aliases[$id]['url']; @@ -130,24 +130,24 @@ if ($_POST) { /* input validation */ $reqdfields = explode(" ", "name"); - $reqdfieldsn = explode(",", "Name"); + $reqdfieldsn = array(",", gettext("Name")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); $x = is_validaliasname($_POST['name']); if (!isset($x)) { - $input_errors[] = "Reserved word used for alias name."; + $input_errors[] = gettext("Reserved word used for alias name."); } else if ($_POST['type'] == "port" && (getservbyname($_POST['name'], "tcp") || getservbyname($_POST['name'], "udp"))) { - $input_errors[] = "Reserved word used for alias name."; + $input_errors[] = gettext("Reserved word used for alias name.)"; } else { if (is_validaliasname($_POST['name']) == false) - $input_errors[] = "The alias name may only consist of the characters a-z, A-Z, 0-9, _."; + $input_errors[] = gettext("The alias name may only consist of the characters a-z, A-Z, 0-9, _."); } /* check for name conflicts */ if (empty($a_aliases[$id])) { foreach ($a_aliases as $alias) { if ($alias['name'] == $_POST['name']) { - $input_errors[] = "An alias with this name already exists."; + $input_errors[] = gettext("An alias with this name already exists."); break; } } @@ -156,12 +156,12 @@ if ($_POST) { /* Check for reserved keyword names */ foreach($reserved_keywords as $rk) if($rk == $_POST['name']) - $input_errors[] = "Cannot use a reserved keyword as alias name $rk"; + $input_errors[] = sprintf(gettext("Cannot use a reserved keyword as alias name %s"), $rk); /* check for name interface description conflicts */ foreach($config['interfaces'] as $interface) { if($interface['descr'] == $_POST['name']) { - $input_errors[] = "An interface description with this name already exists."; + $input_errors[] = gettext("An interface description with this name already exists."); break; } } @@ -183,10 +183,10 @@ if ($_POST) { $alias['url'] = $_POST['address0']; $alias['updatefreq'] = $_POST['address_subnet0'] ? $_POST['address_subnet0'] : 7; if (!is_URL($alias['url']) || empty($alias['url'])) { - $input_errors[] = "You must provide a valid URL."; + $input_errors[] = gettext("You must provide a valid URL."); $dont_update = true; } elseif (! process_alias_urltable($alias['name'], $alias['url'], 0, true)) { - $input_errors[] = "Unable to fetch usable data."; + $input_errors[] = gettext("Unable to fetch usable data."); $dont_update = true; } } @@ -231,14 +231,14 @@ if ($_POST) { } if($isfirst == 0) { /* nothing was found */ - $input_errors[] = "You must provide a valid URL. Could not fetch usable data."; + $input_errors[] = gettext("You must provide a valid URL. Could not fetch usable data."); $dont_update = true; break; } $alias['aliasurl'][] = $_POST['address' . $x]; mwexec("/bin/rm -rf {$temp_filename}"); } else { - $input_errors[] = "You must provide a valid URL."; + $input_errors[] = gettext("You must provide a valid URL."); $dont_update = true; break; } @@ -254,12 +254,12 @@ if ($_POST) { $wrongaliases .= " " . $_POST["address{$x}"]; } else if ($_POST['type'] == "port") { if (!is_port($_POST["address{$x}"])) - $input_errors[] = $_POST["address{$x}"] . " is not a valid port or alias."; + $input_errors[] = $_POST["address{$x}"] . " " . gettext("is not a valid port or alias."); } else if ($_POST['type'] == "host" || $_POST['type'] == "network") { if (!is_ipaddr($_POST["address{$x}"]) && !is_hostname($_POST["address{$x}"]) && !is_iprange($_POST["address{$x}"])) - $input_errors[] = $_POST["address{$x}"] . " is not a valid {$_POST['type']} alias."; + $input_errors[] = sprintf(gettext("%s is not a valid %s alias."), $_POST["address{$x}"], $_POST['type']; } if (is_iprange($_POST["address{$x}"])) { list($startip, $endip) = explode('-', $_POST["address{$x}"]); @@ -274,11 +274,11 @@ if ($_POST) { if ($_POST["detail{$x}"] <> "") $final_address_details[] = $_POST["detail{$x}"]; else - $final_address_details[] = "Entry added " . date('r'); + $final_address_details[] = sprintf(gettext("Entry added %s"), date('r')); } } if ($wrongaliases <> "") - $input_errors[] = "The alias(es): {$wrongaliases} \ncannot be nested cause they are not of the same type."; + $input_errors[] = sprintf(gettext("The alias(es): %s \ncannot be nested cause they are not of the same type."), $wrongaliases); } if (!$input_errors) { @@ -444,8 +444,8 @@ $update_freq_str = gettext("Update Freq."); $networks_help = gettext("Networks are specified in CIDR format. Select the CIDR mask that pertains to each entry. /32 specifies a single host, /24 specifies 255.255.255.0, etc. Hostnames (FQDNs) may also be specified, using a /32 mask. You may also enter an IP range such as 192.168.1.1-192.168.1.254 and a list of CIDR networks will be derived to fill the range."); $hosts_help = gettext("Enter as many hosts as you would like. Hosts must be specified by their IP address."); $ports_help = gettext("Enter as many ports as you wish. Port ranges can be expressed by seperating with a colon."); -$url_help = gettext("Enter as many URLs as you wish. After saving {$g['product_name']} will download the URL and import the items into the alias. Use only with small sets of IP addresses (less than 3000)."); -$urltable_help = gettext("Enter a single URL containing a large number of IPs and/or Subnets. After saving {$g['product_name']} will download the URL and create a table file containing these addresses. This will work with large numbers of addresses (30,000+) or small numbers."); +$url_help = sprintf(gettext("Enter as many URLs as you wish. After saving %s will download the URL and import the items into the alias. Use only with small sets of IP addresses (less than 3000)."), $g['product_name']); +$urltable_help = sprintf(gettext("Enter a single URL containing a large number of IPs and/or Subnets. After saving %s will download the URL and create a table file containing these addresses. This will work with large numbers of addresses (30,000+) or small numbers."), $g['product_name']); $openvpn_str = gettext("Username"); $openvpn_user_str = gettext("OpenVPN Users"); @@ -549,10 +549,10 @@ EOD;
- + - + - + - + @@ -595,13 +595,13 @@ EOD; - + - + " type="text" class="formfld unknown" id="detail" size="50" value="" />
Alias Edit
Name @@ -561,30 +561,30 @@ EOD;
- The name of the alias may only consist of the characters a-z, A-Z and 0-9. +
Description
- You may enter a description here for your reference (not parsed). +
Type
-
Item information
+
Network
CIDR
Description
- + " />
  - - + " /> + " />
-- cgit v1.1