[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debian-devel:12647] Re: now debconf Japanized



佐野@浜松です。

In article <20000707010110.7e94c95d.yosshy@xxxxxxxxx>,
  at "Fri, 7 Jul 2000 01:01:57 +0900',
   with "[debian-devel:12642] now debconf Japanized",
 Akira YOSHIYAMA <yosshy@xxxxxxxxx> さん writes:

> 吉山@品川です。
> 
> debconf で日本語が表示されるようになりました。
> …といっても、debconf 自体の設定のみ、つまり、
> 
> 	# dpkg-reconfigure debconf
> 
> を実行した時ぐらいですが。

御苦労さまです。_o_

> # 何で debconf の ja.po は機能しないんだろう…

これは debconf 以外のパッケージの設定をした場合ですか ?

あと debconf って中心部分は perl で動いてたと思ってたんですが、
 gettext も使ってたんですか ?

と思って

  find /usr/lib/perl5/Debian/DebConf/ -type f |xargs grep -i setlocale

したら

/usr/lib/perl5/Debian/DebConf/Template.pm:      my $language=setlocale(5); # LC_MESSAGES

と出ました。

=head1 DESCRIPTION

This is an object that represents a Template. Each Template has some associated
data, the fields of the template structure. To get at this data, just use
$template->fieldname to read a field, and $template->fieldname(value) to write
a field. Any field names at all can be used, the convention is to lower-case
their names. All Templates should have a "template" field that is their name.
Most have "default", "type", and "description" fields as well. The field
named "extended_description" holds the extended description, if any.

Templates support internationalization. If LANG or a related environment
variable is set, and you request a field from a template, it will see if
"$ENV{LANG}-field" exists, and if so return that instead.

と書いてありますね。

関係するのは

# Calculate the current locale, with aliases expanded, and normalized.
# May also generate a fallback.
sub _getlangs {
        # I really dislike hard-hoding 5 here, but the POSIX module sadly does
        # not let us get at the value of LC_MESSAGES in locale.h in a more 
        # portable way.
        my $language=setlocale(5); # LC_MESSAGES
        if ($language eq 'C' || $language eq 'POSIX') {
                return;
        }
        # Try to do one level of fallback.
        elsif ($language=~m/^(\w\w)_/) {
                return $language, $1;
        }
        return $language;
}

と

=head2 any other method

Set/get a property. This supports internationalization.

=cut

{
        my @langs=_getlangs();

        sub AUTOLOAD {
                my $this=shift;
                my $property = $AUTOLOAD;
                $property =~ s|.*:||; # strip fully-qualified portion
                
                $this->{$property}=shift if @_;
                
                # Check to see if i18n should be used.
                if (@langs) {
                        foreach my $lang (@langs) {
                                if (exists $$this{$property.'-'.$lang}) {
                                        $property.='-'.$lang;
                                        last;
                                }
                        }
                }
                
                return $this->{$property};
        }
}

かな。

man  perllocale したんですが

       LANGUAGE    NOTE: LANGUAGE is a GNU extension, it affects
                   you only if you are using the GNU libc.  This
                   is the case if you are using e.g. Linux.  If
                   you are using "commercial" UNIXes you are most
                   probably not using GNU libc and you can ignore
                   LANGUAGE.

                   However, in the case you are using LANGUAGE:
                   it affects the language of informational,
                   warning, and error messages output by commands
                   (in other words, it's like LC_MESSAGES) but it
                   has higher priority than the LC_ALL manpage.
                   Moreover, it's not a single value but instead
                   a "path" (":"-separated list) of languages
                   (not locales).  See the GNU gettext library
                   documentation for more information.


しか書いてないみたい。 perl script から gettext を使って *.po の
メッセージを切り替えて使う方法ってどうやるんでしょう ?

  find /usr/lib/perl5/Debian/DebConf/ -type f |xargs grep locale

しても Template.pm 以外には FrontEnd/Gtk.pm の  set_locale Gtk; だけ
しか無さそう。

-- 
     # (わたしのおうちは浜松市、「夜のお菓子」で有名さ。)
    <kgh12351@xxxxxxxxxxx> : Taketoshi Sano (佐野 武俊)