Mailing List Archive

sx.translations 1.2 released!
I'm pleased to announce a new release of sx.translations.

This release records the dates untranslated msgids were first seen.

sx.translations provides components for use with Zope 3 and Zope 2 +
Five that implement both ITranslationDomain and ILanguageAvailability as
well as supporting the recording of untranslated msgids.

This means that, not only do the components support the interface
require to provide messages to Zope 3's i18n framework, they can also be
used to generate a list of available languages using code similar to the
following:

from zope.component import getUtility
from zope.i18n.interfaces import ILanguageAvailability
from zope.i18n.locales import locales, LoadLocaleError

domain = 'myproject'

def getLanguages(self):
options = getUtility(ILanguageAvailability,
domain).getAvailableLanguages()
options.sort()
result = []
for option in options:
lang = option[0]
try:
locale = locales.getLocale(lang)
except LoadLocaleError:
# probably not a real locale
continue
result.append(
{'code':lang,
'name':locale.displayNames.languages[lang],
)
return result

Sample ZCML for configuration could be:

<configure xmlns="http://namespaces.zope.org/zope";
xmlns:i18n="http://namespaces.simplistix.co.uk/translations";>

<!-- make the sx.translations' registerTranslations directive
available -->
<include package="sx.translations" file="meta.zcml" />

<!-- register our locales using sx.translations -->
<i18n:registerTranslations locales="../locales"
missing="../locales/myproj.pot"
encoding="utf-8"/>

</configure>

For more information, please see:
http://www.simplistix.co.uk/software/zope/sx.translations

cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
_______________________________________________
Zope-Announce maillist - Zope-Announce@zope.org
http://mail.zope.org/mailman/listinfo/zope-announce

Zope-Announce for Announcements only - no discussions

(Related lists -
Users: http://mail.zope.org/mailman/listinfo/zope
Developers: http://mail.zope.org/mailman/listinfo/zope-dev )