diff --git a/sources/config.php b/sources/config.php index 1c67cca..cb1edbc 100644 --- a/sources/config.php +++ b/sources/config.php @@ -28,7 +28,7 @@ function configure() { } // Gettext function -function T_($string) { +function _($string) { return gettext($string); } @@ -39,7 +39,7 @@ function before($route) { ); if(!isset($_SESSION['locale'])) { - $locale = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); + $locale = explode(',', $_SERVER['HTTP_ACCEP_LANGUAGE']); $_SESSION['locale'] = strtolower(substr(chop($locale[0]), 0, 2)); } diff --git a/sources/controller.php b/sources/controller.php index b38e162..3fbb969 100644 --- a/sources/controller.php +++ b/sources/controller.php @@ -185,44 +185,44 @@ dispatch_put('/settings', function() { } if(in_array($ssid['wifi_ssid'], $wifi_ssid_uniqueness)) { - throw new Exception(T_('All Wifi names must be unique')); + throw new Exception(_('All Wifi names must be unique')); } else { array_push($wifi_ssid_uniqueness, $ssid['wifi_ssid']); } if(in_array($ssid['ip4_nat_prefix'], $ip4_nat_prefix_uniqueness)) { - throw new Exception(T_('All IPv4 NAT prefixes must be unique')); + throw new Exception(_('All IPv4 NAT prefixes must be unique')); } else { array_push($ip4_nat_prefix_uniqueness, $ssid['ip4_nat_prefix']); } if($ssid['ip6_net'] != 'none' && in_array($ssid['ip6_net'], $ip6_net_uniqueness)) { - throw new Exception(T_('All IPv6 delegated prefixes must be unique')); + throw new Exception(_('All IPv6 delegated prefixes must be unique')); } else { array_push($ip6_net_uniqueness, $ssid['ip6_net']); } if(empty($ssid['wifi_ssid']) || empty($ssid['wifi_passphrase'])) { - throw new Exception(T_('Your Wifi Hotspot needs a name and a password')); + throw new Exception(_('Your Wifi Hotspot needs a name and a password')); } if($ssid['wifi_secure'] && (strlen($ssid['wifi_passphrase']) < 8 || strlen($ssid['wifi_passphrase']) > 63)) { - throw new Exception(T_('Your password must from 8 to 63 characters (WPA2 passphrase)')); + throw new Exception(_('Your password must from 8 to 63 characters (WPA2 passphrase)')); } if($ssid['wifi_secure'] && preg_match('/[^[:print:]]/', $ssid['wifi_passphrase'])) { - throw new Exception(T_('Only printable ASCII characters are permitted in your password')); + throw new Exception(_('Only printable ASCII characters are permitted in your password')); } if(!$wifi_device_exists) { - throw new Exception(T_('The wifi antenna interface seems not exist on the system')); + throw new Exception(_('The wifi antenna interface seems not exist on the system')); } if($ssid['ip6_net'] != 'none') { $ssid['ip6_net'] = ipv6_expanded($ssid['ip6_net']); if(empty($ssid['ip6_net'])) { - throw new Exception(T_('The IPv6 Delegated Prefix format looks bad')); + throw new Exception(_('The IPv6 Delegated Prefix format looks bad')); } $ip6_blocs = explode(':', $ssid['ip6_net']); @@ -236,7 +236,7 @@ dispatch_put('/settings', function() { $ssid['ip6_dns0'] = ipv6_expanded($ssid['ip6_dns0']); if(empty($ssid['ip6_dns0'])) { - throw new Exception(T_('The format of the first IPv6 DNS Resolver looks bad')); + throw new Exception(_('The format of the first IPv6 DNS Resolver looks bad')); } $ssid['ip6_dns0'] = ipv6_compressed($ssid['ip6_dns0']); @@ -245,7 +245,7 @@ dispatch_put('/settings', function() { $ssid['ip6_dns1'] = ipv6_expanded($ssid['ip6_dns1']); if(empty($ssid['ip6_dns1'])) { - throw new Exception(T_('The format of the second IPv6 DNS Resolver looks bad')); + throw new Exception(_('The format of the second IPv6 DNS Resolver looks bad')); } $ssid['ip6_dns1'] = ipv6_compressed($ssid['ip6_dns1']); @@ -253,25 +253,25 @@ dispatch_put('/settings', function() { } if(inet_pton($ssid['ip4_dns0']) === false) { - throw new Exception(T_('The format of the first IPv4 DNS Resolver looks bad')); + throw new Exception(_('The format of the first IPv4 DNS Resolver looks bad')); } if(inet_pton($ssid['ip4_dns1']) === false) { - throw new Exception(T_('The format of the second IPv4 DNS Resolver looks bad')); + throw new Exception(_('The format of the second IPv4 DNS Resolver looks bad')); } if(inet_pton("${ssid['ip4_nat_prefix']}.0") === false) { - throw new Exception(T_('The format of the IPv4 NAT Prefix (/24) looks bad : x.x.x expected)')); + throw new Exception(_('The format of the IPv4 NAT Prefix (/24) looks bad : x.x.x expected)')); } if(filter_var("${ssid['ip4_nat_prefix']}.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) !== false) { - throw new Exception(T_('The IPv4 NAT Prefix must be from a private range')); + throw new Exception(_('The IPv4 NAT Prefix must be from a private range')); } array_push($ssids, $ssid); } } catch(Exception $e) { - flash('error', T_('Hotspot')." $id: ".$e->getMessage().' ('.T_('configuration not updated').').'); + flash('error', _('Hotspot')." $id: ".$e->getMessage().' ('._('configuration not updated').').'); goto redirect; } } @@ -299,13 +299,13 @@ dispatch_put('/settings', function() { $retcode = start_service(); if($retcode == 0) { - flash('success', T_('Configuration updated and service successfully reloaded')); + flash('success', _('Configuration updated and service successfully reloaded')); } else { - flash('error', T_('Configuration updated but service reload failed')); + flash('error', _('Configuration updated but service reload failed')); } } else { - flash('success', T_('Service successfully disabled')); + flash('success', _('Service successfully disabled')); } redirect: diff --git a/sources/i18n/README.md b/sources/i18n/README.md index 18898af..4c84437 100644 --- a/sources/i18n/README.md +++ b/sources/i18n/README.md @@ -25,7 +25,7 @@ mkdir -p sources/i18n/fr_FR/LC_MESSAGES/ Generate the po file: ``` -msginit --locale=fr_FR.UTF-8 -i sources/i18n/localization.pot -o sources/i18n/fr_FR/LC_MESSAGES/localization.po +msginit --locale=fr_FR.UTF-8 --no-translator -i sources/i18n/localization.pot -o sources/i18n/fr_FR/LC_MESSAGES/localization.po ``` You can use poedit for translating the po: diff --git a/sources/views/_ssid.html.php b/sources/views/_ssid.html.php index a86d433..7a5d8b3 100644 --- a/sources/views/_ssid.html.php +++ b/sources/views/_ssid.html.php @@ -1,26 +1,26 @@
>
-

">

+

">

- +
- -
+ +
/>
@@ -28,10 +28,10 @@
> - +
- - + +
@@ -41,27 +41,27 @@
- +
- +
- +
@@ -71,21 +71,21 @@ -

+

- + - + -   Loading... +   Loading...