I’ve been getting more than the usual number of “my translations don’t show up” reports on the Loco plugin support forum recently. After a couple of people mentioned they had recently upgraded to WordPress 4.0, I thought I’d better take a closer look at what might have changed. As it turns out, something pretty major.
Without making much noise about it, WP4 has deprecated the WPLANG constant. If you upgraded from any previous version of WordPress, this will still be defined in your wp-config.php
file, and will now be quietly ignored. This setting is now held in the database as an “option” of the same name. In the admin area under General Settings > Site Language you can change the setting through a dropdown list of the language packs you have installed.
The note that accompanies this new field states “The WPLANG
constant in your wp-config.php
file is no longer needed.”. If you have WP_DEBUG
enabled then you’ll also see a deprecation notice.
I don’t think these discreet warnings are sufficient for a change that can break such long-standing previous behaviour, so if you’re distributing a plugin or theme and want to avoid complaints that your localisation doesn’t work, I suggest adding a code snippet like this to make more noise in the Wordpress admin area. Add it into your theme’s functions.php file, or your plugin’s main PHP file and the user will see the following warning:
See Gist for code example: https://gist.github.com/timwhitlock/110d5bd9a8f0bb2d40b3
Thanks for your useful tip :)
Man, I wish I had read your post hours ago. I’ve been pulling my hairs out trying to find out why my spanish locale wasn’t loading and my english locale was just fine.
And what can I do now to make the translation visible? I am not quite q newbie but I am not a developer so I really don’t know what to do now. Help!