2
# used by *ubuntu-docs packages
6
our ($yes); map { $yes{$_}=1 }
7
#******************************************************************************
8
#**** read DapperFirefoxStartPageTranslation before changing this list ! ****
11
ar bg_BG bn bn_IN ca cs_CZ da_DK de de_DE el en_GB es es_AR
12
es_ES eu fi_FI fr fr_FR ga_IE gl gu_IN he_IL hu_HU it_IT ja_JP
13
ko ku lt mk_MK mn nb_NO nl nl_NL pa_IN pl_PL pt pt_BR ro_RO ru_RU
14
sk sl_SI sv_SE tr_TR zh_CN zh_TW
17
#**** read DapperFirefoxStartPageTranslation before changing this list ! ****
18
#******************************************************************************
23
$0 is a tool to help with
24
http://wiki.ubuntu.com/DapperFirefoxStartPageTranslation
27
print list of translateable locales
30
maps LOCALE to best translateable locale (`-' means en_US)
32
$0 SRCDIR PKGSTAGING ALTDIR DSTPATH ENUSLINKSRC
33
for use in debian/rules of a *ubuntu-docs package
34
installs index-*.html files and symlinks.
35
SRCDIR the directory containing all the index-*.html files
36
(not symlinks) which are the available translations
37
PKGSTAGING directory (eg debian/ubuntu-docs) where the package is
39
ALTDIR DapperFirefoxStartPageTranslation's ALTDIR, incl. leading /
40
ENUSLINKSRC symlink text to use for untranslated but translateable
41
locales; should be a relative link from ALTDIR to
42
to the default en_US start page
47
#---------- and now the program: ----------
51
return $l if exists $ehash->{$l};
52
if ($l =~ s/_.*$//) { return $l if exists $ehash->{$l}; }
54
return $l if exists $ehash->{$l};
60
if ($want eq '--list') {
61
print join(' ', sort keys %yes),"\n" or die $!;
62
} elsif ($want =~ m/^\-/) {
63
die "$0; unknown option \`$want'\n";
65
our ($got) = maplocale($want, %yes);
66
$got='-' if $got eq '';
67
print "$got\n" or die $!;
70
our ($srcdir, $pkgstaging, $altdir, $enuslinksrc) = @ARGV;
71
our (@files, %file, $want, $got, $dstpath, $linksrc, $linkdst);
72
@files= glob "$srcdir/index-*.html";
73
$dstpath= $pkgstaging.$altdir;
74
$!=0; system('install','-m755','-oroot','-groot','-d',$dstpath)
75
and die "$0: create $dstpath: $? $!\n";
77
$!=0; system('install','-m644','-oroot','-groot',@files,"$dstpath/.")
78
and die "$0: install @files in $dstpath: $? $!\n";
80
map { m,index-([^/]+)\.html$, or die; $file{$1}=0; } @files;
81
foreach $want (sort keys %yes) {
82
$got= maplocale($want, %file);
85
$linksrc= "index-$got.html";
87
$linksrc= $enuslinksrc;
89
push @map, [ $want, ($got eq $want ? "= " :
90
length $got ? "-> $got" : "-> -") ];
91
next if $want eq $got;
92
$linkdst= "$dstpath/index-$want.html";
93
remove($linkdst) or $!==&ENOENT or die "$0: remove old $linkdst: $!\n";
94
symlink($linksrc, $linkdst)
95
or die "$0: symlink $linksrc $linkdst: $!\n";
98
our $rows= ceil(@map / $cols);
99
for ($row=0; $row<$rows; $row++) {
100
for ($col=0, $i=$col*$rows + $row;
101
$col<$cols && $i<@map;
103
printf "%s %-5s %s", ($col?"\t":""), @{$map[$i]} or die $!;
105
print "\n" or die $!;
107
foreach $got (keys %file) {
108
next if $file{$got} >= 1;
109
print STDERR "$0: installed unuseable translation for $got\n";
112
die "$0: bad usage\n\n$usage\n";