Hi All,
I just checked in the first major pass of the i18n architecture
restructure. This includes:
1. moving all image and html resources from application to
/Chandler/chandler/resources
2. Removing the locale directory which is now deprecated
3. Creating the Chandler/chandler/i18n and the I18nManager and
OSAFMessageFactory
4. Updating Dialogs and some of the CPIA code to leverage the
OSAFMessageFactory and I18nManager
5. Updating the Utility.py to use unicode file system paths
6. Migrating all locale setting and look up logic to the I18nManager
More things which I am forgetting to mention at the moment :)
I will be updating the i18n documentation to reflect the new changes
that have taken place.
Here is a bit of an overview:
I18nManager:
1. Locates resources such as images and html files
2. Handles the translation of LocalizableStrings
3. Manages all Locale set lookup and discovery
example:
>>> from i18n import I18nManager
>>> #accepts str or unicode and looks up the image path based on the locale
>>> file = I18nManager.getImage("ApplicationBar.png")
>>> bytes = file.read()
OSAFMessageFactory:
1. Creates LocalizableStrings in the "osaf" domain. The domain is used
to locate the translation files. For Chandler core we will have one
domain "osaf". Parcel developers will have unique domains which can
arbitrarily be specified. For example, a domain can apply to one parcel
or a grouping of parcels.
example:
>>> from i18n import OSAFMessageFactory as _
>>> #accepts str or unicode
>>> localizableString = _("this is a test")
>>> localizableString
>>> LocalizableString('osaf', u'this is a test')
>>> #the output will change depending on the current Locale Set
>>> print localizableString.encode("utf8")
>>> 'this is a test'
>>> localizableString.toUnicode()
>>> u'this is a test'
I have also gotten rid of all gettext imports in the code base and
temporarily overriden _() in the global dict to return the value passed
till I finish the porting to use the OSAFMessageFactory.
I welcome your feedback,
Brian Kirsch
--
Brian Kirsch - Email Framework Engineer
Open Source Applications Foundation
543 Howard St. 5th Floor
San Francisco, CA 94105
(415) 946-3056
http://www.osafoundation.org
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev