WPML, a plugin for handling multilingual content in WordPress, has the ability to read an XML file for its configuration. In this language configuration file, we can define which custom fields, custom post types, taxonomies and admin texts we want translatable in our theme.
I’ve been using a WooThemes commercial theme for a client, but ran in to a problem when trying to translate the footer. The theme allows the user to add custom content for the footer through a text field in its options panel; this text is therefore not wrapped in any gettext function, blocking WPML from hooking in to it automatically.
The problem was solved by adding the following (saved as
wpml-config.xml) to the root of the parent theme folder:
<wpml-config> <admin-texts> <key name='woo_options'> <key name='woo_footer_left_text' /> <key name='woo_footer_right_text' /> </key> </admin-texts> </wpml-config>
This file tells WPML to make the values of the two listed keys into translatable strings, to be found under WPML → String Translation.
woo_options is the name of the option (itself an array) containing the needed values.
wpml-config.xml provides a clean, simple way to define translatable strings for the often troublesome elements of a theme; ask your commercial theme providers to provide these configuration files with all of their themes.