• Resolved baboehm

    (@baboehm)


    Hi there,
    I’ve just taken over care for a website that is using Polylang and the “Spacious” Theme.

    I am not really familiar with Polylang, and I couldn’t find an answer in their docs, so perhaps someone here can help me out.

    That theme has a Customizer option for a slider, which in turn has text-inputs and textareas in the Customizer, where you can put in title and text for said slider.

    There is a wpml-config.xml file present, which lists those inputs and they are visible and the strings are visible under “languages->translations”, but whatever is being put in there does nor appear in the frontend.

    How should I go about translating these inputs or rather what is being put in there?
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    Thread Starter baboehm

    (@baboehm)

    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!

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.