[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Luxembourgish translations



Quoting Frank Lanitz (frank@frank.uvena.de):
> Hi around, 
> 
> Today I've got a question on how to handle a translation file correct -
> Luxembourgish. 
> 
> According to ISO 639-1 the language code should be lb,
> but unfortunately I'm not able to find these inside list locales is
> supporting. Also I've checked Ubuntu[1] and there sees to be the
> language code available. Since I'm totally aware of the differences
> between Debian and Ubuntu and I wasn't able to find some discussion
> about inside archive. So how is the typical way here, since de_LU
> which would be an alternative would be not correct for a real
> Luxembourgish as well as seems to also be not supported by glibc on
> Debian. 


The first step is building an lb_LU locale.

A common way to do this is by modifying an existing locale. as some
parts of a locale are more related to the country than the language,
you can start by modifying the fr_LU or de_LU locale, depending on
which language you're more familiar with (I'd guess German..:-)).

For this, copy /usr/share/i18n/locales/de_LU to a file named "lb_LU".

Then modify the language-related things to replace German words by
Letzeburgesch words.

Locale files use a fairly cryptic "U+NNNN" notation for Unicode
characters so that may be uneasy.

Thankfully, Denis Barbier created, in the past, two scripts named
uxx2utf and utf2uxx that allow to convert these files to UTF-8 encoded
files back and forth.

So, you just convert lb_LU to lb_LU.utf.....then edit the file...then
convert it back.

Once done (and checked), you can send the new locale as a bug report
against the locales package. glibc maintainers in Debian will push it
upstream as well as integrate it in Debian's glibc. So, Debian...and
Ubuntu...will have it soon and even other distros will benefit from
the locale quite soon.

Then you'll be able to start working on translations..:)


#! /usr/bin/perl

use encoding 'utf8';

sub c {
	my $text = shift;
	my $ret = '';
	my $lastpos = 0;
	while ($text =~ m/\G(.*?)<U(....)>/g) {
		$lastpos = pos($text);
		$ret .= $1;
		my $n = hex($2);
		if ($n < 0x80) {
			$ret .= pack("U", $n);
		} elsif ($n < 0xc0) {
			$ret .= pack("UU", 0xc2, $n);
		} elsif ($n < 0x100) {
			$ret .= pack("UU", 0xc3, $n & 0xbf);
		} else {
			$ret .= pack("U", $n);
		}
	}
	return $ret.substr($text, $lastpos);
}

my $last = '';
while (<>) {
	if ($last ne '') {
		$_ = $last . $_;
		$last = '';
	}
	if (m/\/\s*$/s) {
		s/\/\s*$//s;
		$last = $_;
		next;
	}
	s/"([^"]*)"/'"'.c($1).'"'/eg;
	s/";\s*"/";"/g;
	print;
}

#! /usr/bin/perl -C1

sub c {
	my $text = shift;
	my $convert_ascii = shift;
	my $ret = '';
	while ($text =~ s/(.)//) {
		$l = unpack("U", $1);
		if ($convert_ascii == 0 && $l < 0x80) {
			$ret .= $1;
		} else {
			$ret .= sprintf "<U%04X>", $l;
		}
	}
	return $ret;
}

my $convert_ascii = 1;
while (<>) {
	if (/^LC_IDENTIFICATION/) {
		$convert_ascii = 0;
	} elsif (/^END LC_IDENTIFICATION/) {
		$convert_ascii = 1;
	}
	my $conv = $convert_ascii;
	$conv = 0 if (/^(copy|include)/);
	s/"([^"]*)"/'"'.c($1, $conv).'"'/eg;
	print;
}

Attachment: signature.asc
Description: Digital signature


Reply to: