[Chandler-dev] Chandler I18n Status
Brian Kirsch
bkirsch at osafoundation.org
Fri Jun 9 19:02:23 PDT 2006
Hello,
Markku and I have had a very busy and productive two weeks in the
Chandler I18n world.
I just wanted to send an update to list before I head off on vacation.
So what have we gotten done:
1. The Unit and Functional Tests now use non-ascii characters for all
displayable and user level strings. This change illustrated that
precautions were not being taken to correctly convert unicode to
bytes when calling file system and logging API's. It also revealed
a few string casts that were taking place in the Functional Test Suite.
2. The Chandler code base and tests now works with non-ascii file paths
and non-ascii CHANDLERHOME paths on all three supported platforms Linux,
OS X, and Windows XP.
3. Determined the best way to work with unicode and the Python file
system API's on all three platforms. The rule of thumb is:
If one is converting unicode to bytes and is going to pass those
bytes to a Python file system API in the os package,
the utf8 encoding should be used. For example:
>>> u = u"/home/bkirsch/MyNonASCIIFilePath\u00FC"
>>> os.mkdir(u.encode("utf8"))
If one is converting bytes returned by a Python file system API
in the os package to Python unicode
the sys.getfilesystemencoding() character set should be used. For
example,
>>> path = os.getcwd()
>>> unicodePath = unicode(path, sys.getfilesystemencoding())
4. Chandler now uses WxWidgets to determine the Locale the Operating
System is running under. We used PyICU in the
past but it did not always return accurate results.
5. The WxPython / WxWidgets localization files now get loaded when
Chandler starts. Wx maintains its own localizations for
things such as the Ok and Cancel button or the &File menu header.
To see this in action start Chandler with the de (German locale).
./release/RunChandler -l de
Go to the File menu and select Accounts. The Account preferences
dialog will open and the Cancel button will be
localized to the German work for Cancel "Abbruch" by Wx.
6. A new MessageFactory was added to the Chandler i18n package to access
Wx localized strings from Chandler code:
>>> from i18n import wxMessageFactory as w
>>> #Assuming the current locale Chandler is running under is
German (de)
>>> print w("Cancel").encode("utf8")
u'Abbruch'
7. The About dialog was moved from a static HTML file on disk to Python.
Having a static file meant one would have to
be created for each support Chandler locale as the verbiage required
localization. Moving the About dialog text to Python code,
the Chandler translation service can be leveraged and no static
files are required.
8. Uncovered two new i18n related bugs:
Bug:6017
<http://bugzilla.osafoundation.org/show_bug.cgi?id=6017> Setting
wxLocale on Linux raises error even though Locale is valid.
Bug:6021
<http://bugzilla.osafoundation.org/show_bug.cgi?id=6021> Repository
fails to open when a non-ascii file path is used on Windows XP
9. Held meetings and discussions on the chandler-dev list about how best
to load translations in to Chandler.
Specifically, if the Repository was used for any type of
localization then a second means would be
need for those cases when the Repository has not been created yet
but localized strings were required.
This was less than ideal and was logged in bug 6007.
The original intent was to use eggs to load localizations and bypass
the Repository all together. However,
the code needed to accomplish this task had not been written yet.
Markku took it upon himself to
write a proof of concept that has shown that *Yes* we can use eggs
to ship and load gettext translation files
and localized resources such as images an HTML files. Good work Markku!
This proof of concept will be incorporated in to the Chandler i18n
framework when I return from vacation.
But we achieved our goal of keeping the Chandler
Internationalization framework and the Repository independent.
10. Markku is currently working on a patch that will allow developers to
create GUI layouts in .xrc files and still take
advantage of the Chandler Translation Service. This patch involves
work at the WxWidgets layer as well as some shell
scripting. We currently use .xrc files for many of the dialogs in
Chandler including the Account Preferences dialog.
Developing with .xrc files is also very popular in the WxPython
community and adding this support is a big win for
our third party developer base. He will be checking in his work
sometime next week.
Well that about sums it up!
See ya in two weeks,
Brian
--
Brian Kirsch - Cosmo Developer / Chandler Internationalization Engineer
Open Source Applications Foundation
543 Howard St. 5th Floor
San Francisco, CA 94105
http://www.osafoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osafoundation.org/pipermail/chandler-dev/attachments/20060609/be398a3f/attachment.html
More information about the chandler-dev
mailing list