diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-12-17 17:28:14 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-12-17 17:28:14 +0000 |
commit | 224b14cb6b741fb15dcc4fd170306dc0165cba29 (patch) | |
tree | 6135c5e28a8638890df3e201b5b349136aedb0ba /perl-install/common.pm | |
parent | d057708b3e1217b809c383563d54ae9e316bf189 (diff) | |
download | drakx-backup-do-not-use-224b14cb6b741fb15dcc4fd170306dc0165cba29.tar drakx-backup-do-not-use-224b14cb6b741fb15dcc4fd170306dc0165cba29.tar.gz drakx-backup-do-not-use-224b14cb6b741fb15dcc4fd170306dc0165cba29.tar.bz2 drakx-backup-do-not-use-224b14cb6b741fb15dcc4fd170306dc0165cba29.tar.xz drakx-backup-do-not-use-224b14cb6b741fb15dcc4fd170306dc0165cba29.zip |
no_comment
Diffstat (limited to 'perl-install/common.pm')
-rw-r--r-- | perl-install/common.pm | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm index 5a1a722c1..8830299be 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -91,7 +91,7 @@ sub mode { my @l = stat $_[0] or die "unable to get mode of file $_[0]: $!\n"; $ sub psizeof { length pack $_[0] } sub touch { - my $f = shift; + my ($f) = @_; unless (-e $f) { local *F; open F, ">$f"; @@ -244,14 +244,14 @@ sub unmakedev { $_[0] >> 8, $_[0] & 0xff } sub translate { my ($s) = @_; -#- $ENV{LANG} in first place until load_po can handle multiple locales - my ($lang) = $ENV{LANG} || $ENV{LANGUAGE} || $ENV{LC_MESSAGES} || $ENV{LC_ALL} || $ENV{LANG} || 'en'; + my ($lang) = $ENV{LANGUAGE} || $ENV{LC_MESSAGES} || $ENV{LC_ALL} || $ENV{LANG} || 'en'; - require 'lang.pm'; - lang::load_po ($lang) unless defined $po::I18N::{$lang}; #- the space if needed to mislead perl2fcalls (as lang is not included here) - $po::I18N::{$lang} or return $s; - my $l = *{$po::I18N::{$lang}}; - $l->{$s} || $s; + require lang; + foreach (split ':', $lang) { + lang::load_po($_) unless defined $po::I18N::{$_}; + return ${$po::I18N::{$_}}{$s} || $s if %{$po::I18N::{$_}}; + } + $s; } sub untranslate($@) { @@ -364,9 +364,19 @@ sub template2file($$%) { sub substInFile(&@) { my $f = shift; - local @ARGV = @_ or return; - local ($^I, $_) = ''; - while (<>) { &$f($_); print } + foreach my $file (@_) { + if (-e $file) { + local @ARGV = $file; + local ($^I, $_) = ''; + while (<>) { &$f($_); print } + } else { + local *F; my $old = select F; # that way eof return true + local $_ = ''; + &$f($_); + select $old; + output($file, $_); + } + } } sub best_match { |