Site icon Hip-Hop Website Design and Development

Two text domains in one plugin

From start: A = main plugin(the library), B = child plugin

I develop a plugin B that will depend on another plugin A in order to work properly. I do this because I’m one of the persons who don’t like code duplication. So I have a plugin with the library required for other plugins A and another plugin that will do only what it should but only if plugin A is activated.

Everything is working well, but… I also need to make the plugin B independent and to archieve this I must include the main library. Is simple and all I need to do is to change a few lines of code.

Here is the potential problem. In plugin A I have the translation text domain example_text_a and in the child plugin(B) it is example_text_b.

Both are using something like this to load the languages:

add_action( 'plugins_loaded', 'example_load_translations' );
function example_load_translations() {
    load_plugin_textdomain( 
        'example_text_X', 
        false, 
        dirname( plugin_basename( __FILE__ ) ) . '/languages/' 
    ); 
}

Now the question. Is it possible to load two different lang text domains in a single plugin? And if YES, will cause this any conflicts?

I would apreciate more help regarding localization if possible. Thank you.