Call for localization testing

Aurélien Gâteau aurelien.gateau at canonical.com
Fri Apr 3 09:10:56 BST 2009


Harald Sitter wrote:
> Hoy!
> 
> Today I pushed a fix for [1] to bzr and uploaded a test package to kubuntu-
> experimental (for jaunty that is).
> Everyone (that includes those that use english or anything else :P) please 
> give it a try. Since the patch fiddles with kdeglobals, we really do not want 
> to have a bug in there.
> 
> It takes the LANG environment variable (or extracts them from appropriate 
> files if not set), then runs a regexp on it to determine the country of your 
> language.
> de_AT => at
> en_CA => ca
> ...
> It will then write those values to kdeglobals in order to get settings fitting 
> your country (currency, day format, time format, ...).
> 
> In addition to that it should handle the following cases properly:
> no LANG is set, or the regexp check is returning an empty string (which would 
> for example be the case with LANG=C).
> 
> Should I have missed a case where the change applies invalid data, or if the 
> country value doesn't get set at all (you can check that through the regional 
> KCM in systemsettings) please report.
> 
> [1] https://bugs.edge.launchpad.net/ubuntu/+source/kdebase-
> workspace/+bug/224461

Haven't tested it yet, but I have a few suggestions for the shell script.

$locale contains the full file, so it might contain multiple lines,
which will probably break the "if". It would be better IMHO to do
something like this:

...
if [ -e /etc/default/locale ]; then
    locale=/etc/default/locale
elif [ -e /etc/environment ]; then
    locale=/etc/environment
fi
if [ $locale ]; then
    country=`sed -e 's/^LANG="\([A-Za-z]*\)_\([A-Za-z]*\)\..*"$/\2/'
$locale |tr 'A-Z' 'a-z'`
...

The sed regex can be simplified a bit: you do not need the first group
since you do not use it in the replace part:

sed -e 's/^LANG="[A-Za-z]*_\([A-Za-z]*\)\..*"$/\1/'

Aurélien



More information about the kubuntu-devel mailing list