summaryrefslogtreecommitdiffstats
path: root/perl-install/install/share/generate-xlocales
blob: 60607af7b98d0d59b89713f21487c3f79ac3698a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/perl
#
# Copyright (C) 2006 Mandriva
#                         Pablo Saraxtaga <pablo@mandriva.com>
#                         Thierry Vignaud <thierry.vignaud.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

use strict;
use lib qw(..); # for lang
# perl_checker: use lib qw(/usr/lib/libDrakX/)
use MDK::Common;
use lang;

my $prefix = $ARGV[0];

my $dir = "$prefix/usr/share/X11/locale";
mkdir_p($dir);

output("$dir/locale.alias",
qq(# automatically build list; only valid for install
# since gtk+-2 is used, which uses unicode internally,
# all locales to UTF-8 ones
),
       sort(uniq((map { "$_:\t\t\ten_US.UTF-8\n" } lang::list_langs()),
                 (map { "$_:\t\t\ten_US.UTF-8\n" } (@lang::locales)),
                 qq(zh_CN.gb2312:\t\t\ten_US.UTF-8
zh_CN.GB2312:\t\t\ten_US.UTF-8
zh_CN.Big5:\t\t\ten_US.UTF-8
),
             ),
        ),
   );

output("$dir/locale.dir",
       qq(# automatically build list ; only valid for install
C/XLC_LOCALE:   C
en_US.UTF-8/XLC_LOCALE: UTF-8
iso8859-1/XLC_LOCALE:   ISO8859-1
),
       map { s/(.*_..)(\.[^@]*)*(\@.*)*$/${1}.UTF-8${3}/; "en_US.UTF-8/XLC_LOCALE: $_\n" } @lang::locales
   );


output("$dir/compose.dir",
       qq(# list automatically build list ; only valid for install
C/Compose:   C
en_US.UTF-8/Compose: UTF-8
iso8859-1/Compose:   ISO8859-1
),
       map {
           s/(.*_..)(\.[^@]*)*(\@.*)*$/${1}.UTF-8${3}/; 
           "en_US.UTF-8/Compose: $_\n";
       } @lang::locales
   );