Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow test of overwriting translations of plone domain #17

Open
idgserpro opened this issue Dec 9, 2015 · 4 comments
Open

Allow test of overwriting translations of plone domain #17

idgserpro opened this issue Dec 9, 2015 · 4 comments

Comments

@idgserpro
Copy link

If I create a product that overrides translations of domain plone following this documentation, I can't test the translations overwritten.

This is because the plone.app.testing always loads the zcml of the Products.CMFPlone (which in turn loads the zcml of the plone.app.locales) before of zcml of my product.

@idgserpro
Copy link
Author

@mauritsvanrees you can help here?

@mauritsvanrees
Copy link
Member

I guess you could use a different layer for this. Do not use the plone.app.testing layers, but use a lower level one from plone.testing, for example the Zope 2 layer:
https://pypi.python.org/pypi/plone.testing#zope-2
In your layer setup load your own zcml first and maybe then the Products.CMFPlone or the plone.app.locales zcml and then it should work.
Note: I have not tried this.

@idgserpro
Copy link
Author

@mauritsvanrees I even tried it. But I had to load all zcmls that my package required, one by one. That doesn't seem right.

@mauritsvanrees
Copy link
Member

Loading your own configure.zcml should be enough to load all the zcmls of your package.

Is 'all zcmls' such a long list then? Maybe including dependency packages?

Maybe the list gets too long because you try to test too much. I can imagine that it is tricky to set this up correctly so you can test what a template returns. You could load the zcml that has your i18n:registerTranslations directive and load the configure.zcml from plone.app.locales, and then simply call something like this to get a direct translation:

translate('the msgid you want to test', domain='plone',
          target_language='your favourite language code')

See https://github.com/mauritsvanrees/maurits.i18ntalk/blob/master/talk.rst#explicit-translations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants