diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2003-01-24 11:41:34 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2003-01-24 11:41:34 +0000 |
commit | 1344c430fe7852aab13944e6c1831a8c7d2c6bb1 (patch) | |
tree | a04a317febe514afd2f3696fa710f39d19aacb25 | |
parent | f131284da380e1abcb14c1a37198337ab223c55a (diff) | |
download | drakx-1344c430fe7852aab13944e6c1831a8c7d2c6bb1.tar drakx-1344c430fe7852aab13944e6c1831a8c7d2c6bb1.tar.gz drakx-1344c430fe7852aab13944e6c1831a8c7d2c6bb1.tar.bz2 drakx-1344c430fe7852aab13944e6c1831a8c7d2c6bb1.tar.xz drakx-1344c430fe7852aab13944e6c1831a8c7d2c6bb1.zip |
fix non latin1 post-install perl-gtk2 apps, seems like perl upgrading strings to utf8 is somewhat broken (dunno why), so now we bind the codeset or our textdomains to utf8 and tag the translated strings to utf8, when using gtk
-rw-r--r-- | perl-install/c/stuff.xs.pl | 15 | ||||
-rw-r--r-- | perl-install/common.pm | 11 | ||||
-rw-r--r-- | perl-install/interactive.pm | 2 | ||||
-rw-r--r-- | perl-install/lang.pm | 6 |
4 files changed, 16 insertions, 18 deletions
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 403735ae2..aa9fda760 100644 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -179,21 +179,6 @@ setMouseLive(display, type, emulate3buttons) '; print ' -SV * -dgettext_utf8(domainname, msgid) - char * domainname - char * msgid - - CODE: - /* always convert to UTF8, because perl will fail to do it correctly - * during install (and it needs to be done for gtk2-perl) - presumably - * due to incorrect locales */ - RETVAL = iconv_(dgettext(domainname, msgid), nl_langinfo(CODESET), "UTF-8"); - SvUTF8_on(RETVAL); - - OUTPUT: - RETVAL - char * dgettext(domainname, msgid) char * domainname diff --git a/perl-install/common.pm b/perl-install/common.pm index 5fa23c479..339e0aa00 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -51,16 +51,23 @@ sub salt { sub makedev { ($_[0] << 8) | $_[1] } sub unmakedev { $_[0] >> 8, $_[0] & 0xff } -sub translate { +sub translate_real { my ($s) = @_; $s or return ''; foreach ('libDrakX', @::textdomains) { - my $s2 = $::isInstall && eval { $::o->isa('interactive::gtk') } ? c::dgettext_utf8($_, $s) : c::dgettext($_, $s); + my $s2 = c::dgettext($_, $s); return $s2 if $s ne $s2; } $s; } +sub translate { + my $s = translate_real(@_); + $::need_utf8_i18n and c::set_tagged_utf8($s); + $s; +} + + sub untranslate { my $s = shift || return; foreach (@_) { translate($_) eq $s and return $_ } diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index 58b019a37..9761d83a1 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -105,6 +105,8 @@ sub vnew { if (!$@) { my $o = interactive::gtk->new; if ($icon && $icon ne 'default' && !$::isWizard) { $o->{icon} = $icon } else { undef $o->{icon} } + c::bind_textdomain_codeset($_, 'UTF8') foreach 'libDrakX', @::textdomains; + $::need_utf8_i18n = 1; return $o; } } else { diff --git a/perl-install/lang.pm b/perl-install/lang.pm index 860544481..6abc10553 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -779,6 +779,7 @@ sub bindtextdomain() { c::setlocale(); c::bind_textdomain_codeset('libDrakX', 'UTF-8'); + $::need_utf8_i18n = 1; c::bindtextdomain('libDrakX', $localedir); $localedir; @@ -828,7 +829,10 @@ sub load_console_font { #- in console mode install, ensure we'll get translations in the right codeset #- (charset of locales reported by the glibc are UTF-8 during install) - $acm and c::bind_textdomain_codeset('libDrakX', lang2charset($lang)); + if ($acm) { + c::bind_textdomain_codeset('libDrakX', lang2charset($lang)); + $::need_utf8_i18n = 0; + } } sub get_x_fontset { |