How to use locale directory from include package and locale directory in my own project.
My main function
settings = dict(settings)
settings.setdefault('jinja2.i18n.domain', 'mypackage1, mypackage2') #NOT WORK!!!
config.include("mypackage1")
config.add_jinja2_search_path(("mypackage1:templates",
"mypackage2:templates"))
config.add_translation_dirs("mypackage1:locale/",
"mypackage2:locale/")
config.add_jinja2_search_path(("mypackage1:templates",
"mypackage2:templates"))
return config.make_wsgi_app()
You might have misunderstood what the context it. To quote the pyramid glossary :
It’s not possible to cumulate contexts by setting it to something like ‘mypackage1, mypackage2’. What you need to do is make sure that all translation dirs have the same domain, set it in the configuration and call
add_translation_dirswith the multiple dirs.