Initial patch contributed by Pedro Algarvio on #7497, many thanks!
Changelog:
- adapt `add_domain` to the Babel:milestone:0.9.4 API + added locking
- added `domain_functions` for creating domain-specific translation functions, to be used in plugins (one would usually create at least `_` and `add_domain`)
Closes #7497.