Drop babel extractor definitions from babel config

Babel allows us to register babel extractors via entry points.
This means we no longer need to have extractor definitions in
each babel config files. All horizon plugins have copies of
babel-django.cfg and babel-djangojs.cfg now. By dropping the
extractor defintiions from babel config files, we can make
a potential migration from django-babel to enmerkar (and
we can also avoid more modifications of babel config files
even if more transition is required).

django-babel and enmerkar both define 'django' extractor
in the entry point, so we can drop it from babel-django.cfg.
This commit also registers 'angular' extractor, so we can drop
the extractor for AngularJS from babel-djangojs.cfg.

Change-Id: Icf93d4551bd3db1baa84c110f06dcc1c36e18b7e
This commit is contained in:
Akihiro Motoki 2019-12-23 17:21:30 +09:00
parent 3a829be260
commit 155bf22788
3 changed files with 5 additions and 10 deletions

View File

@ -1,6 +1,3 @@
[extractors]
django = django_babel.extract:extract_django
[python: **.py] [python: **.py]
[django: **/templates/**.html] [django: **/templates/**.html]
[django: **/templates/**.csv] [django: **/templates/**.csv]

View File

@ -1,10 +1,3 @@
[extractors]
# We use a custom extractor to find translatable strings in AngularJS
# templates. The extractor is included in horizon.utils for now.
# See http://babel.pocoo.org/docs/messages/#referencing-extraction-methods for
# details on how this works.
angular = horizon.utils.babel_extract_angular:extract_angular
[javascript: **.js] [javascript: **.js]
# We need to look into all static folders for HTML files. # We need to look into all static folders for HTML files.

View File

@ -54,3 +54,8 @@ add_comments = Translators:
[entry_points] [entry_points]
oslo.config.opts = oslo.config.opts =
openstack_dashboard = openstack_dashboard.utils.config:list_options openstack_dashboard = openstack_dashboard.utils.config:list_options
# We use a custom extractor to find translatable strings in AngularJS templates.
# See http://babel.pocoo.org/docs/messages/#referencing-extraction-methods for
# details on how this works.
babel.extractors =
angular = horizon.utils.babel_extract_angular:extract_angular