site  contact  subhomenews

Locales improved in Woof

December 13, 2008 — BarryK
I have completely overhauled how locales are handled, compared with Puppy, but this can also be applied to Puppy.

In the 0rootfs-skeleton (Puppy) there is /usr/lib/locales with a small selection of English locales, for example 'en_AU' and 'en_US'. There is also /usr/sbin/chooselocales script which enables changing the locale, by downloading a more complete locales PET package then make a choice, and the choice sets the 'LANG' variable in /etc/profile.

A couple of things wrong with the above scenario:

1. For a start, the locales are not UTF-8, which is really where we should be heading.

2. Secondly, the locales in /usr/lib/locales can be generated from locale files in /usr/share/i18n, by the 'localedef' utility. /usr/share/i18n has two subdirectories, 'charmaps' and 'locales', both of which are cutdown in Puppy.

For Woof, I have removed the contents of /usr/lib/locales. I have put in the full set of files into /usr/share/i18n/locales and left the cutdown selection in /usr/share/i18n/charmaps (except added UTF-8.gz).

To /etc/rc.d/rc.country I have inserted this code:
#v001 creates locale files in /usr/lib/locale...

LANG="`grep '^LANG=' /etc/profile | cut -f 2 -d '='`"
if [ "`locale -a | grep "$LANG"`" = "" ];then
BASELANG="basename $LANG .utf8"
if [ -f /usr/share/i18n/locales/$BASELANG ];then
localedef -f UTF-8 -i $BASELANG --no-archive ${BASELANG}.utf8
else
[ "`locale -a | grep "en_US.utf8"`" = "" ] && localedef -f UTF-8 -i en_US --no-archive en_US.utf8
fi
fi


I have also completely rewritten /usr/sbin/chooselocale, the little GUI app for choosing the locale for your country. All locale files are already in Woof, nothing extra has to be downloaded for any country. Also, UTF-8 is now used, for example en_US.utf8. Woof is going to be much more "internationally capable"!

Comments

Non-English characters in filenames
Username: Leon
sl_SI.utf8 - Puppy 4.1.2 Non-English characters in filenames are not shown properly in Rox and in Gtk Open and Save file dialog. en_US.utf8 - wow's Unnamed pupplet, puppy411 kernel-2.6.27.5 Xorg-7.4 LXDE Non-English characters in filenames are shown properly in PCMan File Manager and in Gtk Open and Save file dialog. Every step to improved internationalization is worth the efforts.


Tags: woof