This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

This package 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 message to Zope 3’s i18n framework, they can also be used to generate a list of avaiable 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

Requirements

Zope 2.12.0 or higher is required.

Installation

To install, simply place the sx folder contained in the distribution onto your PYTHONPATH.

Configuration

Configuration is through ZCML, a complete example of which is shows below:

<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>

\(locales\) is a path pointing to a folder containing locale information in the standard GNU gettext layout, as currently supported by Zope 3.

\(missing\) is a file to which untranslated msgids will be appended in .pot fortmat.

\(encoding\) is optional and specifies the encoding to use for the file specified in the “missing” attribute. If not supplied, a default of utf-8 is used.

Licensing

Copyright (c) 2006-2009 Simplistix Ltd

This Software is released under the MIT License: http://www.opensource.org/licenses/mit-license.html See license.txt for more details.

Changes

1.2 (16 Apr 2009)

  • record dates when missing msgids are found

1.1 (12 Apr 2009)

  • bring up to date for zope.i18n 3.7.0

1.0 (18 Sep 2006)

  • Initial release
Release History

Release History

1.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
sx.translations-1.2.tar.gz (8.6 kB) Copy SHA256 Checksum SHA256 Source Apr 16, 2009

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting