Plugin Author
Tim W
(@timwhitlock)
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. 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. 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
(@baltas)
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
(@timwhitlock)
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 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
(@baltas)
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. ; )