Hanno Schlichting wrote:
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?
Other domains as well. In fact, the only domain I care about is one
specific to the project ;-)
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.
Are there any existing implementations?
Personally I think you are mixing responsibilities here.
Having read your comments, I absolutely agree...
languages might have something to do with registered translation domains
in your case, but that's not an assumption that holds in general.
OK, modified proposal:
TranslationDomain should still implement ILanguageAvailability and
zope.i18n.zcml.registerTranslations should register domains for that
interface as well as ITranslationDomain, but I agree that you may want
to register another utility, probably with no name, that gives you the
overall translation domain.
Does that sounds like a plan?
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.
Yes, this would be done in the little utility, global or local, that is
registered for ILanguageAvailability without a domain...
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.
Well, I don't think getCatalogsInfo is a very useful method, since it's
effectively just a "nice name" for reaching into the guts of the
In any case, I have a need now for several things, so I'm working on a
package called simplistix.translations that implements
ITranslationDomain and the clarified ILanguageAvailability and runs off
an i18n directory full of .po files just like PTS did. It'll also have
an option to turn on a special message catalog that spits out something
like the .missing files you used to be able to get out of PTS.
If anyone's interested in this, please contact me and I'll release it
when I get a chance :-)
Simplistix - Content Management, Zope & Python Consulting
Zope3-dev mailing list