← Back to team overview

ubuntu-accomplishments-contributors team mailing list archive

Multiple language support added to accomplishments sets: please update your branches

 

Hi Everyone,

Tonight I added support for multiple languages inside accomplishments
sets. This will require that you update your branches. You can do this
with:

  cd ubuntu-community-accomplishments
  bzr pull
  ./install.sh /path/to/your/accomplishments/directory

  cd ubuntu-accomplishments-system
  bzr pull

Earlier today I thought I could add support in a way that we could
perform the translations in Launchpad by defining translations with
gettext but after some testing this afternoon it turned out that this
was not going to work effectively (it would match the translation by
the full English content, which means if a typo was fixed in the
English .accomplishment it would invalidate the translations). As such
I decided to go ahead and implement multiple language support as
discussed recently on this list by having sub-directories for each
language.

This means that inside an accomplishments set (e.g.
ubuntu-community-accomplishments) all the accomplishments are now in a
sub-dir which is named after the ISO language (e.g.
accomplishments/ubuntu-community/fr or
accomplishments/ubuntu-community/de).

When the daemon runs it detects the locale on the system and matches
the locale to the best language sub-dir in each accomplishments set.
The code has three fallbacks:

 * First it checks if your system locale matches the sub-dir, if it
does it uses this (e.g. 'en_US' matches a 'en_US' sub-dir).
 * If there is no match there we now match based upon the first two
characters (e.g. if 'en_US' is not available as a sub-dir we look for
a sub-dir called 'en').
 * If there is no match here, we look up the default language for that
accomplishments set from accomplishments/ubuntu-community/ABOUT where
I added a 'langdefault' key which specifies which sub-dir should be
used in the case that a match cannot be made to the system locale.
Some of you may wonder why I didn't just default to English, but some
accomplishments sets (e.g. ubuntu-italian) may have a non-English
default language.

I gave this some pretty thorough testing and it seems to be working
pretty well but do file bugs if you have any issues. Thanks!

   Jono

-- 
Jono Bacon
Ubuntu Community Manager
www.ubuntu.com / www.jonobacon.org
www.identi.ca/jonobacon www.twitter.com/jonobacon