[Zope3-Users] Re: translation domains and their scope
Philipp von Weitershausen
philipp at weitershausen.de
Thu Feb 22 16:48:59 EST 2007
Giovannetti, Mark wrote:
> Hello,
>
> I am having some trouble with translation domains. I
> have setup two for use. Call one 'common' and the other
> 'myapp'. They were created under a folder that was turned
> into a site using the ZMI. Call this site MYSITE.
>
> The translation domains were also registered via the ZMI.
> I have filled in various message ids and their translations
> for en and fr in each domain. I have also made sure to use
> the proper i18n:domain declarations, as appropriate.
>
> For locations under MYSITE, the myapp and common translations
> work well (within a generic browser page template configured
> for ISite):
>
> i.e. http://localhost:8080/MYSITE/
>
> However, using http://localhost:8080/ to display the same
> generic page (as another ISite), the translations do not happen.
>
> I want to use the 'common' translation domain (TD) across more than
> one site (i.e. the use case above would allow me to have a
> splash page at the site root using common translations with
> a choice among subsites).
>
> So, thinking I should move the 'common' TD to the zope instance
> root I use the ZMI cut and paste functions to move the 'common'
> domain from MYSITE to the root/global(?) site. I also checked,
> unregistered, and registered where appropriate.
>
> Now the translations for common, formerly functional under
> MYSITE, no longer work under MYSITE, nor do they work under the
> root site, nor anywhere else.
>
> What gives? Is there something bad about using cut and paste
> to move a translation domain?
>
> How are translation domains looked up and used? What are their
> scopes?
The scope of any local utility (and that includes translation domains)
is the site that it was registered for. It's therefore not surprising
that a translation domain you added and registered in MYSITE are not
available outside that folder.
Why aren't you going for global translation domains that are maintained
as gettext PO files on the filesystem and registered using ZCML? My book
(also the 1st edition) explains how to do that.
--
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5
More information about the Zope3-users
mailing list