Add Locale configuration directive to set the locale when retrieving date from system. Thanks to Klaus Tachtler for the suggestion.

This commit is contained in:
Darold Gilles 2012-12-24 12:52:42 +01:00
parent 348b265b14
commit 2130e3bee6
5 changed files with 74 additions and 12 deletions

13
README
View File

@ -234,6 +234,19 @@ CONFIGURATION
Allow to change the default unit used to display transfert size.
Default is BYTES, other possible values are KB, MB and GB.
MinPie
Minimum percentage of data in pie's graphs to not be placed in the
others item. Lower values will be summarized into the others item.
Locale
Set this to your locale to display generated date in your language.
Default is to use the current locale of the system. If you want date
in German for example, set it to de_DE.
Rapport généré le mardi 11 décembre 2012, 15:13:09 (UTC+0100).
with a Locale set to fr_FR.
AUTHOR
Gilles DAROLD <gilles@darold.net>

View File

@ -410,6 +410,7 @@ sub _init
$self->{AnonymizeLogin} = $options{AnonymizeLogin} || 0;
$self->{SiblingHit} = $options{SiblingHit} || 1;
$self->{ImgFormat} = $options{ImgFormat} || 'png';
$self->{Locale} = $options{Locale} || '';
if ($self->{Lang}) {
open(IN, "$self->{Lang}") or die "ERROR: can't open translation file $self->{Lang}, $!\n";
while (my $l = <IN>) {
@ -1096,7 +1097,11 @@ sub _print_header
{
my ($self, $fileout, $menu, $calendar) = @_;
my $curdate = `date | iconv -t $Translate{CharSet} 2>/dev/null`;
my $lang = '';
if ($self->{Locale}) {
$lang = 'LANG=' . $self->{Locale};
}
my $curdate = `$lang date | iconv -t $Translate{CharSet} 2>/dev/null`;
chomp($curdate);
my $now = $curdate || strftime("%a %b %e %H:%M:%S %Y", localtime);

View File

@ -259,8 +259,22 @@ peer cache hit onto your stats.
Allow to change the default unit used to display transfert size. Default
is BYTES, other possible values are KB, MB and GB.
=back
=item MinPie
Minimum percentage of data in pie's graphs to not be placed in the others
item. Lower values will be summarized into the others item.
=item Locale
Set this to your locale to display generated date in your language. Default
is to use the current locale of the system. If you want date in German for
example, set it to de_DE.
Rapport généré le mardi 11 décembre 2012, 15:13:09 (UTC+0100).
with a Locale set to fr_FR.
=back
=head1 AUTHOR

View File

@ -1,4 +1,4 @@
.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
.\" Automatically generated by Pod::Man 2.26 (Pod::Simple 3.07)
.\"
.\" Standard preamble:
.\" ========================================================================
@ -38,6 +38,8 @@
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
@ -48,17 +50,24 @@
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
@ -124,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "SQUIDANALYZER 1"
.TH SQUIDANALYZER 1 "2012-12-16" "perl v5.10.1" "User Contributed Perl Documentation"
.TH SQUIDANALYZER 1 "2012-12-24" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@ -380,6 +389,21 @@ peer cache hit onto your stats.
.IX Item "TransfertUnit"
Allow to change the default unit used to display transfert size. Default
is \s-1BYTES\s0, other possible values are \s-1KB\s0, \s-1MB\s0 and \s-1GB\s0.
.IP "MinPie" 4
.IX Item "MinPie"
Minimum percentage of data in pie's graphs to not be placed in the others
item. Lower values will be summarized into the others item.
.IP "Locale" 4
.IX Item "Locale"
Set this to your locale to display generated date in your language. Default
is to use the current locale of the system. If you want date in German for
example, set it to de_DE.
.Sp
.Vb 1
\& Rapport gA\*~XnA\*~XrA\*~X le mardi 11 dA\*~Xcembre 2012, 15:13:09 (UTC+0100).
.Ve
.Sp
with a Locale set to fr_FR.
.SH "AUTHOR"
.IX Header "AUTHOR"
Gilles \s-1DAROLD\s0 <gilles@darold.net>

View File

@ -82,3 +82,9 @@ TransfertUnit BYTES
# Minimum percentage of data in pie's graphs to not be placed in the others item.
MinPie 2
# Set this to your locale to display generated date in your language. Default
# is to use the current locale of the system. If you want date in German for
# example, set it to de_DE. For french, fr_FR should do the work.
#Locale en_US