Main menu

Custom folder loading

FAQ: Why don't translations load from the custom folder?

Loco Translate offers a "safe" location for storing translation files. Safe in the sense that WordPress updates should not delete or replace any files that you've saved there.

If WordPress is not loading translations from this location, take the following steps to debug the problem.

Ensure Loco Translate is enabled

That's an easy one. Our plugin must be installed and enabled for the custom location to work.

Check the standard locations

The next thing to do is check whether the same translations can be loaded from the standard WordPress locations. For example: if the following custom path doesn't work:

wp-content/languages/loco/themes/<domain>-<locale>.mo

Move this file to the following path and try again:

wp-content/languages/themes/<domain>-<locale>.mo

This is a standard (unsafe) WordPress location. If this location doesn't work either then this FAQ is not the one you want. (See Translations not showing instead). If this location works, then the problem may be in the theme/plugin that loads the file.

Check the loading functions

Themes and plugins must load their translations using the correct WordPress functions. That means load_theme_textdomain for themes, and load_plugin_textdomain for plugins.

If the bundle author is trying to load translations without going through these functions, Loco Translate will have no way of knowing where to find your custom files. If you're not a developer, check with the author whether they use these standard functions.

Check if the functions are called too early

Even if the bundle calls the correct loading functions, it's not uncommon for authors to run their code too early. Authors should not load translations until all plugins have initialized. If they do, they prevent other plugins (such as Loco Translate) from modifying the standard loading process.

If you're familiar with WordPress hooks then check at what point the author's code starts to load its translation files. If it does so as soon as the file is included then this is almost certainly the root of the problem.

What can I do to fix it?

If Loco Translate is prevented from modifying the loading process there is no solution that doesn't involve writing code. We suggest you contact the bundle author and send them to this page. They can tell you whether they can fix the issue in future releases.

If you're suffering from the early loading problem, you can fix it by installing this code as a "must-use" plugin. It does the same job as Loco Translate's built-in loader, but will run much earlier (before all normal plugins are started up).

If you're unable to use the custom folder, we suggest you take steps to protect your files in the standard locations instead. Disabling translation updates should make the "System" folder safe, see FAQ on disappearing files.