[Zope3-dev] Re: language availablity

Hanno Schlichting plone at hannosch.info
Thu Jul 6 11:20:38 EDT 2006


Hi.

Chris Withers wrote:
> Been looking more into getting lists of available languages for a domain
> out of Zope 3.

Just curious, do you use only the zope domain or some other domains as well?

> Philipp pointed me to zope.i18n.interfaces.ILanguageAvailability, which
> appears to be a tiny interface that's not used anywhere.

It's just an interface for which you can write your own implementation.

> What I'd like to do as give ITranslationDomain a getAvailableLanguages()
> method and get rid of ILanguageAvailability.
> 
> Would anyone have any problems with this?
> Is there a procedure for deprecating interfaces and adding methods to
> existing interfaces?

Personally I think you are mixing responsibilities here. Available
languages might have something to do with registered translation domains
in your case, but that's not an assumption that holds in general. For
instance if I have quite a lot of different domains for various products
which one would be the "master domain" that defines if a language is
available? Or you might want to have some criteria that only lists
translations which are complete and not list those which are just
registered but have no real translations available...

What I would do in your case is to write a small global utility that
implements ILanguageAvailability and returns the list of registered
languages for the domain you had in mind. If you should ever need to
filter the list according to some criteria this utility would be the
right place to do it.

> Right, regardless of the above, I'd like
> zope.i18n.translationdomain.TranslationDomain to grow a
> getAvailableLanguages method. Is anyone working on this?

If you follow my suggestion you could use the getCatalogsInfo method
implemented for translationdomains, no need to add this to the official
interface. I would rather try to keep the interface small and a basic
domain should know how to translate text, not anything more.

Just my humble opinion,
Hanno



More information about the Zope3-dev mailing list