Skip Navigation
Updated
October 16, 2024

WPML can read a configuration file that tells it what needs translation in themes and plugins. The file is named wpml-config.xml and it’s placed in the root folder of the plugin or theme.

The Purpose of the Language Configuration File

As part of achieving compatibility with WPML, you should also create a configuration file that will help you with maintaining compatibility in your future releases. WPML can translate anything on your WordPress site, but you need to tell it what needs translation. This file does that.

Go to the WPML → Settings page.

WPML Settings page

This page tells WPML everything it needs to know, including which custom fields to translate or synchronize, which custom post and taxonomies should be multilingual and even which admin texts to translate.

The language configuration file includes this information so that each and every user doesn’t need to manually enter it in the admin page.

For some of the themes and plugins, we are hosting the language configuration files on our servers. You can see a list here. It is set to override the local language configuration file that is placed inside the root folder of the theme or plugin.

WPML also allows you to manually override any settings loaded by theme and plugin language configuration files. This applies to both, language configuration files inside the root folder of the theme or plugin and the language configuration files hosted on our servers.

Setting Translation Options for Third-party Themes and Plugins

WPML is compatible with many popular themes and plugins and for them, you don’t need to create a language configuration file.

However, if you’re using a theme or plugin whose content doesn’t appear correctly in WPML’s Advanced Translation Editor, you might need to configure their translation options manually.

To configure translation options for third-party themes and plugins, go to WPMLSettings and click the Custom XML Configuration tab. Use the text editor on this page to enter the code just like you would if you were creating a wpml-config.xml file.

Setting translation options for third-party themes and plugins in the Custom XML Configuration tab

Generating the wpml-config.xml File Automatically

If you are not familiar with creating XML files, our team has created the Multilingual Tools plugin that makes this task easier. Although it was initially conceived as a tool for helping theme and plugin authors to make their products multilingual-ready, it can easily be used to generate your own wpml-config.xml file.

To learn more about generating your wpml-config.xml file, visit the Multilingual Tools plugin’s page. Specifically, look under the How do I generate language configuration files using Multilingual Tools? section.

Once you have the configuration file, add it to the root of your theme’s folder. If you already have one, do not overwrite it. Instead, edit your original XML file and add the code generated with the Multilingual Tools plugin.

Please note that this plugin is not intended to be used on the live, production sites.

To read this tutorial and build language configuration files for your themes and plugins, you can start with this example one – wpml-config.zip.

You’ll need to edit it, but you can use the sections and structure of this file.

Structure and Syntax

WPML lets you configure a number of elements using the wpml-config.xml file. Use the following guides to find additional information and instructions on how to make specific site elements translatable:

Using WPML Language Configuration File with Child Themes

If you are using a child theme, the language configuration file of the parent theme overrides the one found in the child theme. WPML provides a configuration page that allows you to easily override this with any custom settings.

Let us consider an example where the language configuration file of the parent theme is setting the custom post type “Property” to be translatable.

The parent language configuration file is setting the property custom post type to translate

If you are using a child theme and want to set the custom post type “Property” to be non-translatable, navigate to the WPML → Settings page and click on the Custom XML Configuration tab. Use the editor to set the custom post type “Property” to be non-translatable. Simply, set the translate attribute value to 0 instead of 1.

Overriding the language configuration settings of the parent theme

The settings in the Custom XML Configuration tab are prioritized over the settings in the language configuration file in the parent theme.