From a45fbb5a3a19950c27324ee6f3c1c1d59e0e30a1 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 27 Mar 2008 11:26:27 +0000 Subject: adapt dansguardian language to system locale --- bin/drakguard | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'bin') diff --git a/bin/drakguard b/bin/drakguard index de91287..0d437d8 100755 --- a/bin/drakguard +++ b/bin/drakguard @@ -15,12 +15,42 @@ use network::shorewall; use network::squid; use services; +my $dansguardian_main_file = "/etc/dansguardian/dansguardian.conf"; my $dansguardian_filter_file = "/etc/dansguardian/dansguardianf1.conf"; my %dansguardian_levels = ( 160 => N_("Low"), 100 => N_("Normal"), 50 => N_("High"), ); +my %dansguardian_langs = ( + arspanish => 'es_AR', + bulgarian => 'bg', + chinesebig5 => 'zh_TW', + chinesegb2312 => 'zh_CN', + czech => 'cs', + danish => 'da', + dutch => 'nl', + french => 'fr', + german => 'de', + hebrew => 'he', + hungarian => 'hu', + indonesian => 'id', + italian => 'it', + japanese => 'ja', + lithuanian => 'lt', + malay => 'ms', + mxspanish => 'es_MX', + polish => 'pl', + portuguese => 'pt', + ptbrazilian => 'pt_BR', + #russian-1251 + 'russian-koi8-r' => 'ru', + slovak => 'sk', + spanish => 'es', + swedish => 'sv', + turkish => 'tr', + ukenglish => 'en', +); my $blacklist_url_file = "/etc/dansguardian/lists/blacklists/drakguard/urls"; my $whitelist_url_file = "/etc/dansguardian/lists/whitelists/drakguard/urls"; @@ -242,6 +272,13 @@ sub read_dansguardian() { } sub write_dansguardian() { + require lang; + my $locale = lang::read(); + my $locale_lang = lang::getlocale_for_lang($locale->{lang}, $locale->{country}); + my %lang_to_dansguardian = reverse %dansguardian_langs; + my $dansguardian_lang = $lang_to_dansguardian{$locale_lang} || $lang_to_dansguardian{$locale->{lang}}; + + subst_config_line($dansguardian_main_file, "language = '$dansguardian_lang'\n") if $dansguardian_lang; subst_config_line($dansguardian_filter_file, "naughtynesslimit = $level\n"); } -- cgit v1.2.1