What I'm trying to do is simple: I have so much WordPress plugins, and 3/4 of them aren't translated in my language, so I want and can translate them all without problems, but I would insert translations inside a directory, so everytime I update plugins I don't have to re-upload in every plugins folder the translation...
Could this in some way be achieved?
It's like as a child theme works; so if you insert for example, header.php in child theme, WordPress will load code from there.
Practically I would create a directory like wp-content/translations/name-of-plugin/en.mo; exists any way to tell WordPress to use that directory to take translations? Thank you!
Add a comment
|
1 Answer
This is, in fact, already available by default. If specific locale isn't available in plugin's folder WordPress will try to fallback to languages directory.
It is defined by WP_LANG_DIR
constant and for plugins the default location would be wp-content/languages/plugins
. Note that name is expected to follow the specific format: name-locale.mo
.
-
Thank you for your answer! So, for example I have the plugin "Stackoverflow WP" and the slug of this plugin is "stackoverflow-wp", and I want to translate it in Italian, it's enough to place the translation in this way: wp-content/languages/plugins/stackoverflow-wp-it.mo? I thought that this could be available by default but I didn't find any information about, online... Thank you again!– OptirootCommented Nov 8, 2015 at 18:47
-
-
Oh okay, I haven't put it because Italian usually doesn't have the full locale part. In fact, in HTML declaration in Italian we use just "it"! Thank you, anyway! So the path is correct?– OptirootCommented Nov 8, 2015 at 19:01
-
-
Perfect. Thank you! Now I don't have time, but tomorrow I will try and let you know. Sorry if I can't vote up your answer, but I need more reputation to do so. Meanwhile, it I marked your answer as solving. I hope it will work. Thank you again! :)– OptirootCommented Nov 8, 2015 at 19:09