diff --git a/includes/html/functions.inc.php b/includes/html/functions.inc.php index 6c08054b8e80..10f1a24917c8 100644 --- a/includes/html/functions.inc.php +++ b/includes/html/functions.inc.php @@ -1616,8 +1616,11 @@ function get_state_label($sensor) /** * Get sensor label and state color + * @param array $sensor + * @param string $type sensors or wireless + * @return string */ -function get_sensor_label_color($sensor) +function get_sensor_label_color($sensor, $type = 'sensors') { $label_style = "label-success"; if (is_null($sensor)) { @@ -1635,6 +1638,6 @@ function get_sensor_label_color($sensor) if (!is_null($sensor['sensor_limit_low']) && $sensor['sensor_current'] < $sensor['sensor_limit_low']) { $label_style = "label-danger"; } - $unit = __('sensors.' . $sensor['sensor_class'] . '.unit'); + $unit = __("$type.{$sensor['sensor_class']}.unit"); return "".trim(format_si($sensor['sensor_current']).$unit).""; } diff --git a/includes/html/pages/wireless.inc.php b/includes/html/pages/wireless.inc.php index 9420c545a5b3..d0094a15164c 100644 --- a/includes/html/pages/wireless.inc.php +++ b/includes/html/pages/wireless.inc.php @@ -43,7 +43,7 @@ $linkoptions .= ''; } - $linkoptions .= generate_link($details['short'], $link_array, array('metric'=> $type, 'view' => $vars['view'])); + $linkoptions .= generate_link(__("wireless.$type.short"), $link_array, array('metric'=> $type, 'view' => $vars['view'])); if ($class == $type) { $linkoptions .= ''; @@ -76,7 +76,7 @@ if (isset($valid_wireless_types[$class])) { $graph_type = 'wireless_' . $class; - $unit = $valid_wireless_types[$class]['unit']; + $unit = __("wireless.$class.unit"); $pagetitle[] = "Wireless :: ".$class; include \LibreNMS\Config::get('install_dir') . '/includes/html/pages/wireless/sensors.inc.php'; } else { diff --git a/includes/html/table/sensors-common.php b/includes/html/table/sensors-common.php index e571990e091f..6a96071d3e96 100644 --- a/includes/html/table/sensors-common.php +++ b/includes/html/table/sensors-common.php @@ -112,7 +112,7 @@ $sensor['sensor_descr'] = substr($sensor['sensor_descr'], 0, 48); - $sensor_current = $graph_type == 'sensor_state' ? get_state_label($sensor) : get_sensor_label_color($sensor); + $sensor_current = $graph_type == 'sensor_state' ? get_state_label($sensor) : get_sensor_label_color($sensor, $translations); $response[] = array( 'hostname' => generate_device_link($sensor), diff --git a/includes/html/table/sensors.inc.php b/includes/html/table/sensors.inc.php index 471c04ea02a2..c308075a5290 100644 --- a/includes/html/table/sensors.inc.php +++ b/includes/html/table/sensors.inc.php @@ -17,5 +17,6 @@ $table = 'sensors'; $tab = 'health'; +$translations = 'sensors'; include 'sensors-common.php'; diff --git a/includes/html/table/wireless-sensors.inc.php b/includes/html/table/wireless-sensors.inc.php index 0df3452aa15f..c9ed411de70c 100644 --- a/includes/html/table/wireless-sensors.inc.php +++ b/includes/html/table/wireless-sensors.inc.php @@ -2,5 +2,6 @@ $table = 'wireless_sensors'; $tab = 'wireless'; +$translations = 'wireless'; include 'sensors-common.php';