From 0f48154802fec2290b26dfea4962d88fc236cab8 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 17 Mar 2005 15:55:02 +0000 Subject: (set_l10n_sort) stole it from rpmdrake --- perl-install/common.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/perl-install/common.pm b/perl-install/common.pm index e81253ed3..5c5168c4c 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -6,10 +6,11 @@ use diagnostics; use strict; use run_program; use vars qw(@ISA @EXPORT $SECTORSIZE); +use POSIX qw(setlocale LC_ALL LC_COLLATE); @ISA = qw(Exporter); # no need to export ``_'' -@EXPORT = qw($SECTORSIZE N N_ check_for_xserver files_exist formatTime formatXiB is_xbox makedev mandrake_release removeXiBSuffix require_root_capability salt setVirtual set_alternative set_permissions translate unmakedev untranslate); +@EXPORT = qw($SECTORSIZE N N_ check_for_xserver files_exist formatTime formatXiB is_xbox makedev mandrake_release removeXiBSuffix require_root_capability salt setVirtual set_alternative set_l10n_sort set_permissions translate unmakedev untranslate); # perl_checker: RE-EXPORT-ALL push @EXPORT, @MDK::Common::EXPORT; @@ -81,6 +82,17 @@ sub untranslate { die "untranslate failed"; } +sub set_l10n_sort() { + my $collation_locale = $ENV{LC_ALL}; + if ($collation_locale) { + $collation_locale =~ /UTF-8/ or setlocale(LC_ALL, "$collation_locale.UTF-8"); + } else { + $collation_locale = setlocale(LC_COLLATE); + $collation_locale =~ /UTF-8/ or setlocale(LC_COLLATE, "$collation_locale.UTF-8"); + } +} + + BEGIN { undef *availableRamMB } sub availableRamMB() { my $s = MDK::Common::System::availableRamMB(); -- cgit v1.2.1