diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-03-27 11:26:27 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-03-27 11:26:27 +0000 |
commit | a45fbb5a3a19950c27324ee6f3c1c1d59e0e30a1 (patch) | |
tree | 82c9b1a5f7b3c29c367cef2edf10566a84156f41 | |
parent | 2e063c5fc6ff3e1fe4fd07874ac6bce6b17fbbc5 (diff) | |
download | drakguard-a45fbb5a3a19950c27324ee6f3c1c1d59e0e30a1.tar drakguard-a45fbb5a3a19950c27324ee6f3c1c1d59e0e30a1.tar.gz drakguard-a45fbb5a3a19950c27324ee6f3c1c1d59e0e30a1.tar.bz2 drakguard-a45fbb5a3a19950c27324ee6f3c1c1d59e0e30a1.tar.xz drakguard-a45fbb5a3a19950c27324ee6f3c1c1d59e0e30a1.zip |
adapt dansguardian language to system locale
-rwxr-xr-x | bin/drakguard | 37 |
1 files changed, 37 insertions, 0 deletions
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"); } |