diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-02-22 16:59:56 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-02-22 16:59:56 +0000 |
commit | fa1413e96cb238d9837afd1942ff93d50d6daec7 (patch) | |
tree | 4fe5eee98866a7a6ba74069119faf651e066ce9b | |
parent | 6bd383497e16a1c5043ec60d0233753d837cbce9 (diff) | |
download | drakx-fa1413e96cb238d9837afd1942ff93d50d6daec7.tar drakx-fa1413e96cb238d9837afd1942ff93d50d6daec7.tar.gz drakx-fa1413e96cb238d9837afd1942ff93d50d6daec7.tar.bz2 drakx-fa1413e96cb238d9837afd1942ff93d50d6daec7.tar.xz drakx-fa1413e96cb238d9837afd1942ff93d50d6daec7.zip |
- remove non needed entries in lang2country
- fix syntax errors
- rename kdefont in charset2kde_font
- much cleanup
-rw-r--r-- | perl-install/lang.pm | 118 |
1 files changed, 50 insertions, 68 deletions
diff --git a/perl-install/lang.pm b/perl-install/lang.pm index f77cc2b3a..18ac805fe 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -409,26 +409,13 @@ my %charset2kde_charset = ( #- for special cases not handled magically my %lang2country = ( - af => 'za', - be => 'by', - br => 'fr', - bs => 'bh', cs => 'cz', - cy => 'gb', da => 'dk', el => 'gr', et => 'ee', - he => 'il', - ja => 'jp', ko => 'kr', mi => 'nz', - ms => 'my', - nn => 'no', sl => 'si', - sp => 'yu', - sr => 'yu', - sv => 'se', - wa => 'be', ); #-###################################################################################### @@ -549,37 +536,31 @@ sub charset2kde_charset { #- font+size for different charsets; the field [0] is the default, #- others are overrridens for fixed(1), toolbar(2), menu(3) and taskbar(4) -my %kdefonts = ( -'iso-8859-1' => [ "adobe-helvetica,12", "courier,10", "adobe-helvetica,11" -'iso-8859-2' => [ "adobe-helvetica,12", "courier,10", "adobe-helvetica,11" -'iso-8859-9' => [ "adobe-helvetica,12", "courier,10", "adobe-helvetica,11" -'iso-8859-15' => [ "adobe-helvetica,12", "courier,10", "adobe-helvetica,11" -'gb2312' => [ "default-ming,16" ], -'euc-jp' => [ "misc-fixed,14", "wadalab-gothic,13" ], -'euc-kr' => [ "daewoo-gothic,16" ], -'Big5' => [ "taipei-fixed,16" ], -'utf_hy' => [ "clearlyu,17" ], -'utf_ka' => [ "clearlyu,17" ], -'utf_vi' => [ "misc-fixed,13", "misc-fixed,13", "misc-fixed,10", ], -'def' => [ "misc-fixed,13", "misc-fixed,13", "misc-fixed,10", ], +my %charset2kde_font = ( + 'iso-8859-1' => [ "adobe-helvetica,12", "courier,10", "adobe-helvetica,11" ], + 'iso-8859-2' => [ "adobe-helvetica,12", "courier,10", "adobe-helvetica,11" ], + 'iso-8859-9' => [ "adobe-helvetica,12", "courier,10", "adobe-helvetica,11" ], + 'iso-8859-15' => [ "adobe-helvetica,12", "courier,10", "adobe-helvetica,11" ], + 'gb2312' => [ "default-ming,16" ], + 'euc-jp' => [ "misc-fixed,14", "wadalab-gothic,13" ], + 'euc-kr' => [ "daewoo-gothic,16" ], + 'Big5' => [ "taipei-fixed,16" ], + 'utf_hy' => [ "clearlyu,17" ], + 'utf_ka' => [ "clearlyu,17" ], + 'utf_vi' => [ "misc-fixed,13", "misc-fixed,13", "misc-fixed,10", ], + 'default' => [ "misc-fixed,13", "misc-fixed,13", "misc-fixed,10", ], ); -sub kdefont { - my ($lang, $type) = @_; - my $charset = lang2charset($lang); - my $kdecharset = charset2kde_charset(lang2charset($lang)); - - my $r; - $r ||= ($kdefonts{$charset})->[$type || 0]; - $r ||= ($kdefonts{$charset})->[0]; - $r ||= ($kdefonts{'def'})->[$type || 0]; - $r ||= ($kdefonts{'def'})->[0]; - -#- the format is "font-name,size,5,kdecharset,0,0" I have no idea of the -#- meaning of that "5"... - $r = $r . ",5," . $kdecharset . ",0,0"; +sub charset2kde_font { + my ($charset, $type) = @_; + my $kdecharset = charset2kde_charset($charset); + + my $font = $charset2kde_font{$charset} || $charset2kde_font{def}; + my $r = $font->[$type] || $font->[0]; - $r; + #- the format is "font-name,size,5,kdecharset,0,0" I have no idea of the + #- meaning of that "5"... + "$r,5,$kdecharset,0,0"; } sub set { @@ -739,33 +720,33 @@ sub write { setVarsInSh($prefix . ($user_only ? "$ENV{HOME}/.i18n" : '/etc/sysconfig/i18n'), $h); eval { - update_gnomekderc($prefix . ($user_only ? "$ENV{HOME}/.kde" : '/usr') . '/share/config/kdeglobals', - Locale => ( - Charset => charset2kde_charset(lang2charset($lang)), - Country => lang2country($lang, $prefix), - Language => lang2kde_lang($lang), - )); -#- The following calls to update_gnomekderc() should be done only if the -#- user switched to a different charset encoding - update_gnomekderc($prefix . ($user_only ? "$ENV{HOME}/.kde" : '/usr') . '/share/config/kdeglobals', - WM => ( - activeFont => kdefont($lang,0), - ), - General => ( - fixed => kdefont($lang, 1), - font => kdefont($lang, 0), - menuFont => kdefont($lang, 3), - taskbarFont => kdefont($lang, 4), - toolBarFont => kdefont($lang, 2), - )); - update_gnomekderc($prefix . ($user_only ? "$ENV{HOME}/.kde" : '/usr') . '/share/config/konquerorrc', - FMSettings => ( - StandardFont => kdefont($lang, 0), - )); - update_gnomekderc($prefix . ($user_only ? "$ENV{HOME}/.kde" : '/usr') . '/share/config/kdesktoprc', - FMSettings => ( - StandardFont => kdefont($lang, 0), - )); + my $charset = lang2charset($lang); + my $confdir = $prefix . ($user_only ? "$ENV{HOME}/.kde" : '/usr') . '/share/config'; + my ($prev_kde_charset) = cat_("$confdir/kdeglobals") =~ /^Charset=(.*)/mi; + update_gnomekderc("$confdir/kdeglobals", Locale => ( + Charset => charset2kde_charset($charset), + Country => lang2country($lang, $prefix), + Language => lang2kde_lang($lang), + )); + + if ($prev_kde_charset ne charset2kde_charset($charset)) { + update_gnomekderc("$confdir/kdeglobals", WM => ( + activeFont => charset2kde_font($charset,0), + )); + update_gnomekderc("$confdir/kdeglobals", General => ( + fixed => charset2kde_font($charset, 1), + font => charset2kde_font($charset, 0), + menuFont => charset2kde_font($charset, 3), + taskbarFont => charset2kde_font($charset, 4), + toolBarFont => charset2kde_font($charset, 2), + )); + update_gnomekderc("$confdir/konquerorrc", FMSettings => ( + StandardFont => charset2kde_font($charset, 0), + )); + update_gnomekderc("$confdir/kdesktoprc", FMSettings => ( + StandardFont => charset2kde_font($charset, 0), + )); + } }; } @@ -879,6 +860,7 @@ sub check { my @wanted_charsets = uniq map { lang2charset($_) } list(); $err->("invalid charset $_ ($_ does not exist in \%charsets)") foreach difference2(\@wanted_charsets, [ keys %charsets ]); + $err->("invalid charset $_ in \%charset2kde_font ($_ does not exist in \%charsets)") foreach difference2([ keys %charset2kde_font ], [ 'default', keys %charsets ]); $warn->("unused charset $_ (given in \%charsets, but not used in \%languages)") foreach difference2([ keys %charsets ], \@wanted_charsets); $warn->("unused entry $_ in \%xim") foreach difference2([ keys %xim ], [ list() ]); |