Plugin Author
Chouby
(@chouby)
Hello,
The wpml-config.xml file is indeed a good way to declare which options Polylang must translate.
I tested the Spacious theme available at https://wordpress.org/themes/spacious/. I found the slider but could not find any wpml-config.xml file. So it doesn’t seem to be the theme you are using.
If you are using the premium version of this theme, then unfortunately I can’t test it and debug what’s wrong. So you will have to rely on the support of the theme author.
If you find the strings in Languages > Translations, then it means that Polylang interprets the wpml-config.xml file correctly.
If the translation doesn’t appear on frontend, then it could come from a Polylang option which was known to cause this kind of issue:
If your Polylang install is quite old, you may have activated the option “The language is set from the content” (we removed it for new installs). Then switching to “The language is set from the directory name” in Languages > Settings > URL modifications may solve the issue.
Otherwise I suggest you to contact the theme author to debug the issue. To help them, we use this filter to translate the option provided by a wpml-config.xml file.
Hi there, thanks for your reply!
I believe the xml file was put there by a predecessor of mine.
That option is indeed set to “The language is set from the content”.
There’s also the option “remove /language/ in readable Permalinks” set though, and if I change to “The language is set from the directory name”, the English URLs all get an /en/ added, which is not wanted in this case.
Can that be amended?
In any case, I did find a different solution in the meantime, with some code in the functions.php, using get_theme_mod() to get the actual strings, pll_register_string() them and then
add_filter('[registered_string]', 'spacious_translate_slider_string', 10, 1);
function spacious_translate_slider_string($value) {
if (function_exists('pll__') && !empty($value)) {
return pll__($value);
}
return $value;
}
That works and I’m happy.
Best wishes!