Add 802.11ac tooltip help text, update messages + compile .mo

This commit is contained in:
billz 2023-03-20 19:14:24 +01:00
parent 9bc54336c2
commit e95f12e91e
6 changed files with 30 additions and 21 deletions

View file

@ -2,6 +2,7 @@
require '../../includes/csrf.php'; require '../../includes/csrf.php';
require_once '../../includes/config.php'; require_once '../../includes/config.php';
require_once '../../includes/locale.php';
if (isset($_POST['interface'])) { if (isset($_POST['interface'])) {
@ -25,16 +26,16 @@ if (isset($_POST['interface'])) {
switch ($flags) { switch ($flags) {
case NL80211_BAND_24GHZ: case NL80211_BAND_24GHZ:
$msg = _("The selected interface has support for the 2.4 GHz wireless band only."); $msg = sprintf(_("The selected interface (%s) has support for the 2.4 GHz wireless band only."), $iface);
break; break;
case NL80211_BAND_5GHZ: case NL80211_BAND_5GHZ:
$msg = _("The selected interface has support for the 5 GHz wireless band only."); $msg = sprintf(_("The selected interface (%s) has support for the 5 GHz wireless band only."), $iface);
break; break;
case NL80211_BAND_24GHZ | NL80211_BAND_5GHZ: case NL80211_BAND_24GHZ | NL80211_BAND_5GHZ:
$msg = _("The selected interface has support for both the 2.4 and 5 GHz wireless bands."); $msg = sprintf(_("The selected interface (%s) has support for both the 2.4 and 5 GHz wireless bands."), $iface);
break; break;
default: default:
$msg = _("The selected interface does not support wireless mode operation."); $msg = sprintf(_("The selected interface (%s) does not support wireless mode operation."), $iface);
} }
echo json_encode($msg); echo json_encode($msg);
} }

View file

@ -389,13 +389,17 @@ function loadChannelSelect(selected) {
} }
/* Sets hardware mode tooltip text for selected interface. /* Sets hardware mode tooltip text for selected interface.
* Messages are sent from ajax request for gettext locale support.
*/ */
function setHardwareModeTooltip() { function setHardwareModeTooltip() {
var iface = $('#cbxinterface').val(); var iface = $('#cbxinterface').val();
var hwmodeText = '';
// Explanatory text if 802.11ac is disabled
if ($('#cbxhwmode').find('option[value="ac"]').prop('disabled') == true ) {
var hwmodeText = $('#hwmode').attr('data-tooltip');
}
$.post('ajax/networking/get_frequencies.php?',{'interface': iface},function(data){ $.post('ajax/networking/get_frequencies.php?',{'interface': iface},function(data){
responseText = JSON.parse(data); var responseText = JSON.parse(data);
$('#tiphwmode').attr('data-original-title', responseText); $('#tiphwmode').attr('data-original-title', responseText + '\n' + hwmodeText );
}); });
} }

View file

@ -796,10 +796,11 @@ function get_public_ip()
* *
* @return string $tooltip * @return string $tooltip
*/ */
function getTooltip($msg, $id, $visible = true) function getTooltip($msg, $id, $visible = true, $data_html = false)
{ {
($visible) ? $opt = 'visible' : $opt = 'invisible'; ($visible) ? $opt1 = 'visible' : $opt1 = 'invisible';
$tooltip = '<i class="fas fa-question-circle text-muted ' .$opt.'" id="' .$id. '" data-toggle="tooltip" data-placement="auto" title="' . _($msg). '"></i>'; ($data_html) ? $opt2 = 'data-html="true"' : $opt2 = 'data-html="false"';
$tooltip = '<i class="fas fa-question-circle text-muted ' .$opt1.'" id="' .$id. '" data-toggle="tooltip" ' .$opt2. ' data-placement="auto" title="' . _($msg). '"></i>';
return $tooltip; return $tooltip;
} }

Binary file not shown.

View file

@ -585,17 +585,20 @@ msgstr "Sets the <code>txpower</code> option for the AP interface and the config
msgid "dBm is a unit of level used to indicate that a power ratio is expressed in decibels (dB) with reference to one milliwatt (mW). 30 dBm is equal to 1000 mW, while 0 dBm equals 1.25 mW." msgid "dBm is a unit of level used to indicate that a power ratio is expressed in decibels (dB) with reference to one milliwatt (mW). 30 dBm is equal to 1000 mW, while 0 dBm equals 1.25 mW."
msgstr "dBm is a unit of level used to indicate that a power ratio is expressed in decibels (dB) with reference to one milliwatt (mW). 30 dBm is equal to 1000 mW, while 0 dBm equals 1.25 mW." msgstr "dBm is a unit of level used to indicate that a power ratio is expressed in decibels (dB) with reference to one milliwatt (mW). 30 dBm is equal to 1000 mW, while 0 dBm equals 1.25 mW."
msgid "The selected interface has support for the 2.4 GHz wireless band only." msgid "The selected interface (%s) has support for the 2.4 GHz wireless band only."
msgstr "The selected interface has support for the 2.4 GHz wireless band only." msgstr "The selected interface (%s) has support for the 2.4 GHz wireless band only."
msgid "The selected interface has support for the 2.5 GHz wireless band only." msgid "The selected interface (%s) has support for the 2.5 GHz wireless band only."
msgstr "The selected interface has support for the 2.5 GHz wireless band only." msgstr "The selected interface (%s) has support for the 2.5 GHz wireless band only."
msgid "The selected interface has support for both the 2.4 and 5 GHz wireless bands." msgid "The selected interface (%s) has support for both the 2.4 and 5 GHz wireless bands."
msgstr "The selected interface has support for both the 2.4 and 5 GHz wireless bands." msgstr "The selected interface (%s) has support for both the 2.4 and 5 GHz wireless bands."
msgid "The selected interface does not support wireless mode operation." msgid "The selected interface (%s) does not support wireless mode operation."
msgstr "The selected interface does not support wireless mode operation." msgstr "The selected interface (%s) does not support wireless mode operation."
msgid "The 802.11ac 5 GHz option is disabled until a compatible wireless regulatory domain is set."
msgstr "The 802.11ac 5 GHz option is disabled until a compatible wireless regulatory domain is set."
#: includes/networking.php #: includes/networking.php
msgid "Summary" msgid "Summary"

View file

@ -17,7 +17,7 @@
<div class="row"> <div class="row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="cbxhwmode"><?php echo _("Wireless Mode") ;?></label> <label for="cbxhwmode"><?php echo _("Wireless Mode") ;?></label>
<?php echo getTooltip('Initial state.', 'tiphwmode', true); ?> <?php echo getTooltip(null, 'tiphwmode', true); ?>
<?php <?php
$countries_5Ghz_max48ch = RASPI_5GHZ_ISO_ALPHA2; $countries_5Ghz_max48ch = RASPI_5GHZ_ISO_ALPHA2;
$selectedHwMode = $arrConfig['hw_mode']; $selectedHwMode = $arrConfig['hw_mode'];
@ -36,7 +36,6 @@
$selectedHwMode = 'w'; $selectedHwMode = 'w';
} }
} }
if (!in_array($arrConfig['country_code'], $countries_5Ghz_max48ch)) { if (!in_array($arrConfig['country_code'], $countries_5Ghz_max48ch)) {
$hwModeDisabled = 'ac'; $hwModeDisabled = 'ac';
if ($selectedHwMode === $hwModeDisabled) { if ($selectedHwMode === $hwModeDisabled) {
@ -44,6 +43,7 @@
} }
} }
SelectorOptions('hw_mode', $arr80211Standard, $selectedHwMode, 'cbxhwmode', 'loadChannelSelect', $hwModeDisabled); ?> SelectorOptions('hw_mode', $arr80211Standard, $selectedHwMode, 'cbxhwmode', 'loadChannelSelect', $hwModeDisabled); ?>
<div id="hwmode" data-tooltip="<?php echo _("The 802.11ac 5 GHz option is disabled until a compatible wireless regulatory domain is set."); ?>"></div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">