Re: rrdtool::graph and German weekday names

Tobias Oetiker <[email protected]> Wed, 1 Nov 2017 20:19:40 +0100
Newsgroups gmane.comp.db.rrdtool.user
Message-ID <[email protected]>
--===============1242327850476134254==
Content-Type: multipart/alternative;
	boundary=Apple-Mail-893B8A3C-A334-47ED-800A-7BE2649550EF
Content-Transfer-Encoding: 7bit


--Apple-Mail-893B8A3C-A334-47ED-800A-7BE2649550EF
Content-Type: text/plain;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Joachim,

Tobias Oetiker

> On 1 Nov 2017, at 19:17, Joachim Hartmann <[email protected]=
> wrote:
>=20
> Hello perl experts,
> I run Munin on a Debian server. In the graphs the days of the week are
> displayed in German. Now I monitor the weather data on a raspberry,
> which basically works, but the days of the week are displayed in
> English. How do I get this Perl script to display the weekdays in
> English?

Chances are that the locale when running as a cgi is different than the loca=
le you got when logging into the server interactively.

I would suggest to use

use POSIX qw(locale_h);
use locale;
setlocale(LC_CTYPE, "de_DE.UTF-8");

INSIDE the script

More details on this to be found here https://perldoc.perl.org/perllocale.ht=
ml

Cheers
Tobi
;
> +++++++++++++++++++++++++++++++++++++++
>=20
> The output of locale is the same for both computers:
>=20
> +++++++++++++++++++++++++++++++++++++++
> # locale
> LANG=3Dde_DE.UTF-8
> LANGUAGE=3D
> LC_CTYPE=3D"de_DE.UTF-8"
> LC_NUMERIC=3D"de_DE.UTF-8"
> LC_TIME=3D"de_DE.UTF-8"
> LC_COLLATE=3D"de_DE.UTF-8"
> LC_MONETARY=3D"de_DE.UTF-8"
> LC_MESSAGES=3D"de_DE.UTF-8"
> LC_PAPER=3D"de_DE.UTF-8"
> LC_NAME=3D"de_DE.UTF-8"
> LC_ADDRESS=3D"de_DE.UTF-8"
> LC_TELEPHONE=3D"de_DE.UTF-8"
> LC_MEASUREMENT=3D"de_DE.UTF-8"
> LC_IDENTIFICATION=3D"de_DE.UTF-8"
> LC_ALL=3D
> ++++++++++++++++++++++++++++++++++++++
> --=20
> Greetings from the home of CeBIT
> Gru=C3=9F aus der Stadt der CeBIT
> Jochen
>=20
> _______________________________________________
> rrd-users mailing list
> [email protected]
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

--Apple-Mail-893B8A3C-A334-47ED-800A-7BE2649550EF
Content-Type: text/html;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D=
utf-8"></head><body dir=3D"auto">Hi Joachim,<br><br><div id=3D"AppleMailSign=
ature">Tobias Oetiker</div><div><br>On 1 Nov 2017, at 19:17, Joachim Hartman=
n &lt;<a href=3D"mailto:[email protected]">joachim.hartmann@gm=
x-topmail.de</a>&gt; wrote:<br><br></div><blockquote type=3D"cite"><div><spa=
n>Hello perl experts,</span><br><span>I run Munin on a Debian server. In the=
 graphs the days of the week are</span><br><span>displayed in German. Now I m=
onitor the weather data on a raspberry,</span><br><span>which basically work=
s, but the days of the week are displayed in</span><br><span>English. How do=
 I get this Perl script to display the weekdays in</span><br><span>English?<=
/span><br></div></blockquote><div><br></div><div>Chances are that the locale=
 when running as a cgi is different than the locale you got when logging int=
o the server interactively.</div><div><br></div><div>I would suggest to use<=
/div><div><br></div><div><a class=3D"l_k" href=3D"https://perldoc.perl.org/f=
unctions/use.html" style=3D"background-color: rgba(255, 255, 255, 0); font-w=
eight: bold;">use</a><span style=3D"background-color: rgba(255, 255, 255, 0)=
;"> </span><span class=3D"w" style=3D"background-color: rgba(255, 255, 255, 0=
);">POSIX</span><span style=3D"background-color: rgba(255, 255, 255, 0);"> <=
/span><span class=3D"q" style=3D"background-color: rgba(255, 255, 255, 0);">=
qw(locale_h)</span><span class=3D"sc" style=3D"background-color: rgba(255, 2=
55, 255, 0);">;</span></div><div><a class=3D"l_k" href=3D"https://perldoc.pe=
rl.org/functions/use.html" style=3D"background-color: rgba(255, 255, 255, 0)=
; font-weight: bold;">use</a><span style=3D"background-color: rgba(255, 255,=
 255, 0);"> </span><span class=3D"w" style=3D"background-color: rgba(255, 25=
5, 255, 0);">locale</span><span class=3D"sc" style=3D"background-color: rgba=
(255, 255, 255, 0);">;</span></div><div><span class=3D"i" style=3D"backgroun=
d-color: rgba(255, 255, 255, 0);">setlocale</span><span class=3D"s" style=3D=
"background-color: rgba(255, 255, 255, 0);">(</span><span class=3D"w" style=3D=
"background-color: rgba(255, 255, 255, 0);">LC_CTYPE</span><span class=3D"cm=
" style=3D"background-color: rgba(255, 255, 255, 0);">,</span><span style=3D=
"background-color: rgba(255, 255, 255, 0);"> </span><span class=3D"q" style=3D=
"background-color: rgba(255, 255, 255, 0);">"de_DE.UTF-8"</span><span class=3D=
"s" style=3D"background-color: rgba(255, 255, 255, 0);">)</span><span class=3D=
"sc" style=3D"background-color: rgba(255, 255, 255, 0);">;</span></div><div>=
<span class=3D"sc" style=3D"background-color: rgba(255, 255, 255, 0);"><br><=
/span></div><div><span class=3D"sc" style=3D"background-color: rgba(255, 255=
, 255, 0);">INSIDE the script</span></div><div><span class=3D"sc" style=3D"b=
ackground-color: rgba(255, 255, 255, 0);"><br></span></div><div><span class=3D=
"sc" style=3D"background-color: rgba(255, 255, 255, 0);">More details on thi=
s to be found here&nbsp;</span><a href=3D"https://perldoc.perl.org/perllocal=
e.html">https://perldoc.perl.org/perllocale.html</a></div><div><span style=3D=
"background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span styl=
e=3D"background-color: rgba(255, 255, 255, 0);">Cheers</span></div><div><spa=
n style=3D"background-color: rgba(255, 255, 255, 0);">Tobi</span></div><div>=
<span style=3D"background-color: rgba(255, 255, 255, 0);">;</span></div><blo=
ckquote type=3D"cite"><div><span>+++++++++++++++++++++++++++++++++++++++</sp=
an><br><span></span><br><span>The output of locale is the same for both comp=
uters:</span><br><span></span><br><span>++++++++++++++++++++++++++++++++++++=
+++</span><br><span># locale</span><br><span>LANG=3Dde_DE.UTF-8</span><br><s=
pan>LANGUAGE=3D</span><br><span>LC_CTYPE=3D"de_DE.UTF-8"</span><br><span>LC_=
NUMERIC=3D"de_DE.UTF-8"</span><br><span>LC_TIME=3D"de_DE.UTF-8"</span><br><s=
pan>LC_COLLATE=3D"de_DE.UTF-8"</span><br><span>LC_MONETARY=3D"de_DE.UTF-8"</=
span><br><span>LC_MESSAGES=3D"de_DE.UTF-8"</span><br><span>LC_PAPER=3D"de_DE=
.UTF-8"</span><br><span>LC_NAME=3D"de_DE.UTF-8"</span><br><span>LC_ADDRESS=3D=
"de_DE.UTF-8"</span><br><span>LC_TELEPHONE=3D"de_DE.UTF-8"</span><br><span>L=
C_MEASUREMENT=3D"de_DE.UTF-8"</span><br><span>LC_IDENTIFICATION=3D"de_DE.UTF-=
8"</span><br><span>LC_ALL=3D</span><br><span>+++++++++++++++++++++++++++++++=
+++++++</span><br><span>-- </span><br><span>Greetings from the home of CeBIT=
</span><br><span>Gru=C3=9F aus der Stadt der CeBIT</span><br><span>Jochen</s=
pan><br><span></span><br><span>_____________________________________________=
__</span><br><span>rrd-users mailing list</span><br><span><a href=3D"mailto:=
[email protected]">[email protected]</a></span><br><span><=
a href=3D"https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users">https://lists=
.oetiker.ch/cgi-bin/listinfo/rrd-users</a></span><br></div></blockquote></bo=
dy></html>=

--Apple-Mail-893B8A3C-A334-47ED-800A-7BE2649550EF--


--===============1242327850476134254==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
rrd-users mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

--===============1242327850476134254==--