diff options
author | Phil Davis <phil.davis@inf.org> | 2017-02-06 18:39:21 +0545 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-02-07 09:40:03 -0200 |
commit | 690db9565601ca8fcd97e9bcea7d2d8701251575 (patch) | |
tree | ccdac7a4140f1416d437a170db720c8b90b94d20 /src/usr/local/www | |
parent | eaa726b593fc5e5aad97ab06e98a1a1ac3762981 (diff) | |
download | pfsense-690db9565601ca8fcd97e9bcea7d2d8701251575.zip pfsense-690db9565601ca8fcd97e9bcea7d2d8701251575.tar.gz |
Internationalization graph.php
1) A few extra strings to be translated.
2) The scale_type code values 'up' and 'follow' need to be kept as those strings in the JS scale_type variable. The text to be translated needs to be in a different variable that can be in translated form for display. Otherwise things go wrong when in a different language.
e.g. switch to Brazilian Portuguese, then the Autoscale. The first times it switches then gets "stuck".
(cherry picked from commit 678f11313b31b28d12d806032b6359a00d6b89a1)
Diffstat (limited to 'src/usr/local/www')
-rw-r--r-- | src/usr/local/www/graph.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/usr/local/www/graph.php b/src/usr/local/www/graph.php index 52e8590..d03ba48 100644 --- a/src/usr/local/www/graph.php +++ b/src/usr/local/www/graph.php @@ -140,7 +140,7 @@ print('<?xml version="1.0" encoding="UTF-8"?>' . "\n");?> <text id="graph_out_txt" x="20" y="16" <?=$attribs['out']?>> </text> <text id="ifname" x="<?=$width?>" y="8" <?=$attribs['graphname']?> text-anchor="end"><?=htmlspecialchars($ifname)?></text> <text id="switch_unit" x="<?=$width*0.55?>" y="5" <?=$attribs['switch_unit']?>><?=gettext("Switch to bytes/s"); ?></text> - <text id="switch_scale" x="<?=$width*0.55?>" y="11" <?=$attribs['switch_scale']?>><?=gettext("AutoScale"); ?> (<?=$scale_type?>)</text> + <text id="switch_scale" x="<?=$width*0.55?>" y="11" <?=$attribs['switch_scale']?>><?=gettext("AutoScale"); ?> (<?=gettext($scale_type);?>)</text> <text id="date" x="<?=$width*0.33?>" y="5" <?=$attribs['legend']?>> </text> <text id="time" x="<?=$width*0.33?>" y="11" <?=$attribs['legend']?>> </text> <text id="graphlast" x="<?=$width*0.55?>" y="17" <?=$attribs['legend']?>><?=sprintf(gettext("Graph shows last %s seconds"), $time_interval*$nb_plot)?></text> @@ -210,6 +210,7 @@ var max_num_points = <?=$nb_plot?>; // maximum number of plot data points var step = <?=$width?> / max_num_points ; var unit = 'bits'; var scale_type = '<?=$scale_type?>'; +var scale_type_text = '<?=gettext($scale_type); ?>'; function init(evt) { SVGDoc = evt.target.ownerDocument; @@ -220,13 +221,14 @@ function init(evt) { } function switch_unit(event) { - SVGDoc.getElementById('switch_unit').firstChild.data = '<?=gettext("Switch to"); ?> ' + unit + '/s'; + SVGDoc.getElementById('switch_unit').firstChild.data = (unit == 'bits') ? '<?=gettext("Switch to bits/s"); ?>' : '<?=gettext("Switch to bytes/s"); ?>'; unit = (unit == 'bits') ? 'bytes' : 'bits'; } function switch_scale(event) { - scale_type = (scale_type == 'up') ? '<?=gettext("follow"); ?>' : '<?=gettext("up"); ?>'; - SVGDoc.getElementById('switch_scale').firstChild.data = 'AutoScale (' + scale_type + ')'; + scale_type = (scale_type == 'up') ? 'follow' : 'up'; + scale_type_text = (scale_type == 'up') ? '<?=gettext("up"); ?>' : '<?=gettext("follow"); ?>'; + SVGDoc.getElementById('switch_scale').firstChild.data = '<?=gettext("AutoScale"); ?>' + ' (' + scale_type_text + ')'; } function fetch_data() { |