Re: [PATCH,RFC] Fetch c-s translations from xkeyboard-config.
- To: debian-boot@lists.debian.org
- Subject: Re: [PATCH,RFC] Fetch c-s translations from xkeyboard-config.
- From: Samuel Thibault <samuel.thibault@ens-lyon.org>
- Date: Fri, 8 May 2009 21:30:47 +0200
- Message-id: <[🔎] 20090508193047.GA26340@const.famille.thibault.fr>
- Mail-followup-to: debian-boot@lists.debian.org
- In-reply-to: <20090404102042.GX5519@const.famille.thibault.fr> <20090401093124.GM7346@const.bordeaux.inria.fr>
- References: <20090401003133.GS8498@const.famille.thibault.fr> <20090401054543.GT5551@mykerinos.kheops.frmug.org> <20090401093124.GM7346@const.bordeaux.inria.fr> <20090404102042.GX5519@const.famille.thibault.fr> <20090401003133.GS8498@const.famille.thibault.fr> <20090401054543.GT5551@mykerinos.kheops.frmug.org> <20090401093124.GM7346@const.bordeaux.inria.fr>
Hello,
Ping timeout :)
Samuel Thibault, le Wed 01 Apr 2009 11:31:24 +0200, a écrit :
> Christian Perrier, le Wed 01 Apr 2009 07:45:43 +0200, a écrit :
> > How big is a udeb built with these translations incorportated?
>
> 176KB.
Samuel Thibault, le Sat 04 Apr 2009 12:20:42 +0200, a écrit :
> Samuel Thibault, le Wed 01 Apr 2009 11:31:24 +0200, a écrit :
> > I've just tested within the debian installer. Some things I assumed
> > were available actually aren't, so here is a fixed patch. However the
> > keyboard layout doesn't get changed, I haven't investigated why yet.
>
> Nothing to do with my patch,
>etc.
There was no further comment, shall I apply my patch? (attached to this
mail)
Samuel
Index: debian/control
===================================================================
--- debian/control (révision 58242)
+++ debian/control (copie de travail)
@@ -3,7 +3,7 @@
Priority: optional
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Uploaders: Anton Zinoviev <zinoviev@debian.org>, Christian Perrier <bubulle@debian.org>
-Build-Depends-Indep: perl, libxml-parser-perl, xkb-data (>= 0.9)
+Build-Depends-Indep: perl, libxml-parser-perl, xkb-data (>= 0.9), locales-all
Build-Depends: debhelper (>= 5), po-debconf
Standards-Version: 3.7.3
Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/console-setup
Index: debian/rules
===================================================================
--- debian/rules (révision 58242)
+++ debian/rules (copie de travail)
@@ -29,9 +29,7 @@
next; \
} \
/## *KBDNAMES *##/ { \
- printf "kbdnames='\''"; \
system("cd Keyboard && ./kbdnames-maker MyKeyboardNames.pl"); \
- printf "'\''"; \
next; \
} \
{ \
Index: debian/config.proto
===================================================================
--- debian/config.proto (révision 58242)
+++ debian/config.proto (copie de travail)
@@ -321,6 +322,18 @@
locale=C
fi
+locale_lang=$(echo $locale | sed 's/_.*//')
+locale_country=$(echo $locale | sed 's/.*_//;s/\..*//;s/@.*//')
+locale_modif=
+echo $locale | grep -v -q @ || locale_modif=$(echo $locale | sed 's/.*@//')
+
+eval kbdnames=\"\${kbdnames_${locale_lang}_${locale_country}__${locale_modif}}\"
+[ -n "$kbdnames" ] || eval kbdnames=\"\${kbdnames_${locale_lang}_${locale_country}}\"
+[ -n "$kbdnames" ] || eval kbdnames=\"\${kbdnames_${locale_lang}__${locale_modif}}\"
+[ -n "$kbdnames" ] || eval kbdnames=\"\${kbdnames_${locale_lang}}\"
+[ -n "$kbdnames" ] || kbdnames="$kbdnames_C"
+! type iconv || kbdnames="$(echo "$kbdnames" | iconv -f UTF-8)"
+
case "$locale" in
*KOI8*|*koi8*)
default_codeset=CyrKoi
Index: Keyboard/kbdnames-maker
===================================================================
--- Keyboard/kbdnames-maker (révision 58242)
+++ Keyboard/kbdnames-maker (copie de travail)
@@ -2,6 +2,8 @@
use warnings 'all';
use strict;
+use Locale::gettext;
+use POSIX;
BEGIN {
my $file;
@@ -13,6 +15,8 @@
do "$file";
}
+print "kbdnames_C='\n";
+
for my $model (keys %KeyboardNames::models) {
my $name = $KeyboardNames::models{$model};
print "model*$name*$model\n"
@@ -26,3 +30,46 @@
print "variant*$name*$variantname*$layout - $variant\n";
}
}
+
+print "'\n";
+
+# Make sure we output UTF-8
+$ENV{'LC_ALL'} = "en_US.UTF-8";
+binmode STDOUT, ":utf8";
+
+sub fixquotes {
+ my $s = shift;
+ $s =~ s/'/'"'"'/g;
+ return $s;
+}
+
+for my $mo (</usr/share/locale/*/LC_MESSAGES/xkeyboard-config.mo>) {
+ my $lang = $mo;
+ $lang =~ s:/usr/share/locale/(.*)/LC_MESSAGES/xkeyboard-config.mo:$1:;
+ print "# Generated for $lang from $mo\n";
+ $ENV{'LANGUAGE'} = $lang;
+ setlocale(LC_ALL,"");
+
+ $lang =~ s:\@:__:;
+ $lang =~ s:__Latn:__latin:; # special fixup for sr
+
+ print "kbdnames_$lang='\n";
+
+ my $d = Locale::gettext->domain("xkeyboard-config");
+
+ for my $model (keys %KeyboardNames::models) {
+ my $name = $KeyboardNames::models{$model};
+ print "model*$name*".fixquotes($d->get($model))."\n"
+ }
+ for my $layout (keys %KeyboardNames::layouts) {
+ my $name = $KeyboardNames::layouts{$layout};
+ my $local_layout = fixquotes($d->get($layout));
+ print "layout*$name*$local_layout\n";
+ print "variant*$name**$local_layout\n";
+ for my $variant (keys %{$KeyboardNames::variants{$name}}) {
+ my $variantname = $KeyboardNames::variants{$name}{$variant};
+ print "variant*$name*$variantname*$local_layout - ".fixquotes($d->get($variant))."\n";
+ }
+ }
+ print "'\n";
+}
Reply to: