Title: Subsets
Last modified: December 19, 2018

---

# Subsets

 *  Resolved [baltas](https://wordpress.org/support/users/baltas/)
 * (@baltas)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/subsets/)
 * I have a question since there is not much information regarding subsets apart
   that they can be used to split the translations trough more than one text domain
   like the WordPress core example mentioned.
 * So my question is if for a plugin that only loads the main text domain all the
   subsets don’t work if they are not loaded also by the plugin or at least forced
   manually from the functions.php, right?
 * What do you think of this idea, there is a parent -> child’s text domains, so
   why those child’s not auto load since they are extensions of the main one (the
   parent)?
 * Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Tim W](https://wordpress.org/support/users/timwhitlock/)
 * (@timwhitlock)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/subsets/#post-11006765)
 * It’s unclear what specific problem you’re having, but your questions imply a 
   couple of misconceptions:
 * 1. When it comes to translations, the child theme is NOT an extension of the 
   main one. [This guide explains more](https://localise.biz/wordpress/plugin/child-themes).
   Their text domains are independent, as is their loading of translation files.
 * 2. Child theme text domains are NOT subsets of the parent text domain. If your
   two themes have one text domain each (as WordPress says they should) you can 
   ignore Loco Translate’s subset feature.
 * Furthermore, “auto loading” of text domains should be avoided.
 * Each theme (by which I mean parent AND child) should independently load its own
   text domain from its own functions.php file. If they don’t do this, then WordPress
   will attempt [JIT loading](https://developer.wordpress.org/reference/functions/_load_textdomain_just_in_time/).
   However, this short-cuts the normal loading process and can have side-effects.
   Most notably it will only look for MO files in the global languages directory(“
   system” location). Perhaps that is the issue you are ultimately having.
 * If you can elaborate on your specific problem, I can give you a more specific
   answer.
 *  Thread Starter [baltas](https://wordpress.org/support/users/baltas/)
 * (@baltas)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/subsets/#post-11012359)
 * Sorry. maybe I choose wrongly the words parent and child as what I’m talking 
   is nothing related with a theme.
 * Just face this scenario, I have a pluging that on it’s starting initialize this:
 * load_plugin_textdomain( ‘xpto-text-domain’, false, basename( ‘my-plugin’ ) . ‘/
   lang’ );
 * a few parts of the code this plugin uses this initialized text domain, but other
   uses something totally different like “abcd-text-domain”, so what I was saying
   is if I want to translate this plugin using Loco I’ll creat the language file
   for the first text domain “xpto-text-domain” and a subset for the other (“abcd-
   text-domain”).
 * What happens right now?
    if the plugin does not load the second domain or I don’t
   do it myself on functions.php I’m not going to have any kind of translations 
   for all the plugin areas that is using this second text domain.
 * So my idea is what about all the defined subsets being auto load since the first/
   main one is a valid and working ok, like this all the translation operation is
   more easier for the normal user?
 * The substs now only make sense for me as a way of organizing and knowing that
   this plugin as other text domains since also is not possible to create separated
   text domains for the same plugin.
 * Off course this happens because sometimes the plugin developers they don’t do
   things right, but it helps bypassing that problem for the translations.
 *  Plugin Author [Tim W](https://wordpress.org/support/users/timwhitlock/)
 * (@timwhitlock)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/subsets/#post-11012655)
 * > So my idea is what about all the defined subsets being auto load
 * I don’t intend to make this Loco Translate’s responsibility. The loading of text
   domains as and when they are needed is the responsibility of the plugin developer.
   I won’t be assuming responsibility for plugins that don’t do so.
 * > Off course this happens because sometimes the plugin developers they don’t 
   > do things right
 * Understood. Which is why auto-loading is already a feature of WordPress. Unfortunately(
   as I already mentioned) it [short-cuts the normal loading process](https://github.com/WordPress/WordPress/blob/master/wp-includes/l10n.php#L1082)
   when no files are found in the system location.
 * If your translations are not loading from Loco’s custom directory then you can
   simply move them to a location where WordPress can see them. This should fix 
   your issue.
 * If you want auto-loading to work with Loco’s custom directory then WordPress 
   will have to fix their auto-loading so that it fires the same actions as during
   normal loading.
 *  Thread Starter [baltas](https://wordpress.org/support/users/baltas/)
 * (@baltas)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/subsets/#post-11012697)
 * Ok I understand.
    Right now I solve my problem manually as I mention before. 
   I just create at functions.php something like this example:
 * function my_load_textdomain() {
    load_plugin_textdomain( ‘abc-text-domain’, false,
   basename( ‘the-used-plugin’ ) . ‘/lang’ ); }
 * add_action( ‘init’, ‘my_load_textdomain’ );
 * Like this the other text domain not initialized by the plugin and that I created
   in Loco as subset of the main one works perfectly, now I get all the necessary
   translations for my new language. ; )

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Subsets’ is closed to new replies.

 * ![](https://ps.w.org/loco-translate/assets/icon-256x256.png?rev=1000676)
 * [Loco Translate](https://wordpress.org/plugins/loco-translate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/loco-translate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/loco-translate/)
 * [Active Topics](https://wordpress.org/support/plugin/loco-translate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/loco-translate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/loco-translate/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [baltas](https://wordpress.org/support/users/baltas/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/subsets/#post-11012697)
 * Status: resolved