summaryrefslogtreecommitdiffstats
path: root/perl-install/lang.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/lang.pm')
-rw-r--r--perl-install/lang.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index c098eb8a1..e6fbb3596 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -369,6 +369,22 @@ sub pack_langs {
$s;
}
+sub unpack_langs {
+ my ($s) = @_;
+ my @l = uniq(map { split ':', $languages{$_}[3] } split(':', $s));
+ my @l2 = intersection(\@l, [ keys %languages ]);
+ +{ map { $_ => 1 } @l2 };
+}
+
+sub read {
+ my ($prefix) = @_;
+ my $h = getVarsFromSh("$prefix/etc/sysconfig/i18n");
+ my $lang = $h ? $h->{LC_MESSAGES} : 'en_US';
+ my $langs =
+ cat_("$prefix/etc/rpm/macros") =~ /%_install_langs (.*)/ ? unpack_langs($1) : { $lang => 1 };
+ $lang, $langs;
+}
+
sub write_langs {
my ($prefix, $langs) = @_;
my $s = pack_langs($langs);