First you need a way of separating the domains.
For instance, let's say you have a domain for lib and one for app, then create a shortcut for the dgettext()
call;
_app(msg) -> dgettext("app", msg);
and one for the lib domain:
_lib(msg) -> dgettext("lib", msg);
Add these calls all over your code, like this;
show_message(_app("Choose a directory to save your work."));
show_message(_lib("No space left on device."));
Remember that you need to call bindtextdomain()
for both domains when initializing your application.
To extract them you need to specify different keywords to xgettext
on all the filenames in your source tree that contains these markers:
xgettext --keyword=_app -d domain1 filenames...
xgettext --keyword=_lib -d domain2 filenames...
Finally, compile both of the .po files into their binary .mo variant and copy/install them to the right location.