You can easily switch between text domains whenever you want. eg:
Considering
./locale/en/LC_MESSAGES/template.po
with content
msgid "foo" msgstr "foobar"
and
./locale/en/LC_MESSAGES/messages.po
with content
msgid "Basic test" msgstr "A basic test"
You can use something like the following PHP code to switch from one text domain to another and then back:
<?php setlocale(LC_ALL, 'en_US.UTF-8'); bindtextdomain ("messages", "./locale"); bindtextdomain ("template", "./locale"); textdomain ("messages"); echo gettext("Basic test"), "\n"; textdomain ("template"); echo _("foo"), "\n"; textdomain ("messages"); echo gettext("Basic test"), "\n";
TML
source share