Support » Plugin: Codestyling Localization » Multiple textdomains in a single plugin

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codestyling


    Yes, the plugin picks up each textdomain contained. It will also write the dedicated *.mo files to disk, if you switch the textdomain select box and press the generate button. The only textdomain not been written to disk in scope of a plugin/theme is the “default” or WordPress textdomain, because this is an issue within the translation context and the author must avoid that.
    Nevertheless my plugin will show a warning, that more than one textdomain is contained to show that this is either accidentally (most cases while copied foreign code blocks) or intentionally like in your illustrated case.

    Okay, I see, multiple textdomains will all be picked up by the plugin, cool. If you have a look at the WooCommerce ticket at Github you’ll see that the discussion now has moved on to the point where we’d keep working with a single textdomain. The only thing that would change is the mo-files that get loaded. In the admin an extra mo-file with admin-only translations would be loaded too. I guess that’s no problem for Codestyling, the only question that remains then is to which file Codestyling will write its translations? Thanks.

    Plugin Author codestyling


    My plugin picks up each textdomain. Let’s assume, that you are using ‘woocommerce‘ and ‘woocommerce-admin‘. You will find both inside the drop down list of contained textdomains and will also face the warning for more than one textdomains.

    By selecting one of them, you will only see those strings, that are related to the given textdomain. All the strings will be hosted within one *.po file. But if you generate the *.mo file, it depends on what textdomain is currently selected.

    Generating the file for textdomain ‘woocommerce‘ will result in writing a file like:
    Generating the file for textdomain ‘woocommerce-admin‘ will result in writing a file like:
    Both files only contains those strings related to the textdomain.

    If your plugin loads both textdomains, than you will get all translations where needed. So the admin one should be loaded only, if you are logged in and working within admin pages.

    Hint: My plugin uses the first found textdomain as the main one. The order of load call appearance in PHP code will determine the choise of plugins main textdomain.

    What about multiple textdomains in one theme?
    As I see Codestyling plugin generates only one file for my theme.
    And this file contains translation with textdomain selected before click ‘generate mo-file’..
    Is that right?

    Hi, same problem

    only one .mo file created, for exemple, depending on what textdomain is currently selected. No compilation nor split.

    Is it different with themes ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Multiple textdomains in a single plugin’ is closed to new replies.