Skip to content

Commit

Permalink
Removing zope.app.appsetup as a dependency
Browse files Browse the repository at this point in the history
zope.app.appsetup drags in most of the rest of Zope 3,
which is not needed to only extract i18n strings from ZCML,
so I copied in the relevant code (and simplified it).
  • Loading branch information
regebro committed Feb 16, 2016
1 parent f1d2a05 commit b26dbd6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 0 additions & 1 deletion setup.py
Expand Up @@ -74,7 +74,6 @@ def read(*rnames):
],
extract=[
'zope.tal',
'zope.app.appsetup',
],
),
include_package_data = True,
Expand Down
11 changes: 8 additions & 3 deletions src/zope/app/locales/extract.py
Expand Up @@ -483,9 +483,14 @@ def py_strings(dir, domain="zope", exclude=(), verify_domain=False):
def zcml_strings(dir, domain="zope", site_zcml=None):
"""Retrieve all ZCML messages from `dir` that are in the `domain`.
"""
from zope.app.appsetup import config
dirname = os.path.dirname
context = config(site_zcml, features=("devmode",), execute=False)
from zope.configuration import xmlconfig, config

# Load server-independent site config
context = config.ConfigurationMachine()
xmlconfig.registerCommonDirectives(context)
context.provideFeature("devmode")
context = xmlconfig.file(site_zcml, context=context, execute=False)

return context.i18n_strings.get(domain, {})

def tal_strings(dir,
Expand Down

0 comments on commit b26dbd6

Please sign in to comment.