• I’m using Polylang v1.1.1 with the latest Pytheas theme (by WPExplorer, which uses Options Framework). The problem I have is that the homepage options that the theme introduces and that are set by the admin via the theme’s options page are not available for translation.

    My settings:

    • Permalinks settings: post name
    • Static frontpage

    Polylang settings:

    • When the front page is visited, set the language according to the browser preference.
    • The language code, for example /en/, is added to all urls when using pretty permalinks.
    • Remove /language/ in pretty permalinks.
    • Hide URL language information for default language.
    • When using static front page, redirect the language page to the front page in the right language

    I tried the solution available in a previous post but it doesn’t work for me – the strings are not added to the string translation table. Please note that the Pytheas theme has been completely rewritten – it’s not exactly the same code as in the Pytheas theme used in the previous post above.

    My wpml-config.xml (located in /wp-content/polylang/:

    <wpml-config>
        <admin-texts>
            <key name='options_wpex_themes'>
                <key name='masterhead_right' />
                <key name='custom_copyright' />
                <key name='home_tagline' />
                <key name='home_services_title' />
                <key name='home_portfolio_title' />
                <key name='home_blog_title' />
            </key>
        </admin-texts>
    </wpml-config>

    Do I need to do anything else to make it work?
    Thanks for your help in advance.

    http://wordpress.org/extend/plugins/polylang/

Viewing 15 replies - 1 through 15 (of 26 total)
  • Plugin Author Chouby

    (@chouby)

    Your wpml-config.xml file is correct if the options are existing.
    Did you fill the values in the theme options?
    Did you check the file permissions?

    In Pytheas 1.0, I found all the relevant informations in the file options.php in the theme directory. It seems that you found this information since you have new / different options.
    Almost on top, I found the lines:

    function optionsframework_option_name() {
        $optionsframework_settings = get_option('optionsframework');
        $optionsframework_settings['id'] = 'options_wpex_themes';
        update_option('optionsframework', $optionsframework_settings);
    }

    To obtain the name of the general option ‘options_wpex_themes’ where all theme options are stored. Is it still the same?

    Thread Starter Frank

    (@femmdi2012)

    Hi Chouby – thanks for your quick response.

    All values in the admin theme options are filled (some with the default and some customized). File permission for wpml-config.xml is 0644 and the polylang folder 0755.

    I also found the information in options.php and took it from there. The part you quoted is identical in the new version:

    function optionsframework_option_name() {
        $optionsframework_settings = get_option('optionsframework');
        $optionsframework_settings['id'] = 'options_wpex_themes';
        update_option('optionsframework', $optionsframework_settings);
    }

    You can check pastebin for the full options.php.

    Plugin Author Chouby

    (@chouby)

    I took your options.php and your custom wpml-config.xml as they are. Then I modified one theme option and saved and it worked (it did not work before I saved the options, most probably because the theme does not save any default option at activation).

    Thread Starter Frank

    (@femmdi2012)

    That’s really strange… I tried again, changed options, saved, deactivated all other plugins, but still no luck. Also tried “reset to default” in the theme options, saved, changed one option, saved again – but no change: the strings don’t show in Settings -> Languages -> String Translation. ANSI/ UTF-8 encoding for wpml-config.xml make no difference neither… Any idea what else I could try?

    Plugin Author Chouby

    (@chouby)

    Is the file name correctly spelled ‘wpml-config.xml’ without any upper case letter? Can you also try to put the file directly in the theme subdirectory?

    Thread Starter Frank

    (@femmdi2012)

    The file name is correctly spelled, no upper case letters. I also tried putting the file in different subdirectories, including the one of the theme but it didn’t change anything.

    I’m quite sure that polylang reads the file because at one point it gave me an error message in the settings page (when I added some taxonomy strings for translation that were already covered in the settings).

    Anyways, I think it has something to do with the new Pytheas code and maybe with the fact that the options framework is now integrated in the theme (no need to install the plugin). For now I rolled back to the old version of the theme and the wpml-config works without problems.

    Plugin Author Chouby

    (@chouby)

    what’s this error message?

    Thread Starter Frank

    (@femmdi2012)

    These are the error messages I received in languages -> settings:

    Warning: array_diff() [function.array-diff]: Argument #1 is not an array in /users/myuser/www/wpfolder/wp-content/plugins/polylang/include/admin.php on line 420

    Warning: array_unique() expects parameter 1 to be array, null given in /users/myuser/www/wpfolder/wp-content/plugins/polylang/include/admin.php on line 420

    With wpml-config.xml:

    <wpml-config>
        <taxonomies>
            <taxonomy translate="1">services</taxonomy>
            <taxonomy translate="1">portfolio</taxonomy>
        </taxonomies>
        <admin-texts>
            <key name='options_wpex_themes'>
                <key name='home_tagline' />
                <key name='home_highlights_title' />
                <key name='home_portfolio_title' />
                <key name='home_blog_title' />
            </key>
        </admin-texts>
    </wpml-config>

    I assume it’s because I added taxonomies in wpml-config.xml that are already taken care of in the settings “customized taxonomies”.

    Plugin Author Chouby

    (@chouby)

    This error should occur if the taxonomies are not existing. I already noticed this bug some days ago and the development version should already solve it.
    http://downloads.wordpress.org/plugin/polylang.zip

    Thread Starter Frank

    (@femmdi2012)

    ok – the error messages are gone in the development version.

    However, back to the initial problem: the fact that I got error messages means that polylang can read the wpml-config.xml, so it’s in the correct folder. Removing the lines about taxonomies also removes the error messages and the wpml-config.xml works with the old version of the Pytheas theme. So I believe the problem with the strings not showing up in the string translation table must be linked to the new Pytheas theme…

    Hi there, I wonder if it might stems from the fact that the ‘old’ Pytheas used and needed the Options Framework plugin installed and activated to enable all the theme options, whereas the ‘new’ Pytheas basically has incorporated this plugin in itself and the theme options are enabled without the need of that plugin.

    mmmm… can’t figure this out!
    The theme now uses home_services_title instead of home_highlights_title, but even replacing it in the code above the strings don’t appear in Settings –> Languages –> String Translation.
    Also on my quick test I couldn’t even enable the menu language switcher because the language switcher tab with the checkbox doesn’t appear in Appearance –> Menus –> Edit Menus.
    @femmdi2012, were you able to add the language switcher to the menu?
    The ‘new’ Pytheas is a LOT different indeed!

    Thread Starter Frank

    (@femmdi2012)

    I rolled back to the old version of the Pytheas theme which seemed to work better with Polylang. As to the new theme, I did not try to add the language switcher to the menu… Sorry for not being more helpful & good luck!

    Good news… maybe, well, at least for the homepage strings.
    The homepage strings are in the default.po file, therefore I thought that they can be translated with something like Poedit and then they would be loaded automatically. I made a very basic es_ES.po for the spanish translation, but the translated strings weren’t loaded and so I had to open template-home.php (in wp-content/themes/wpex-pytheas/templates/) and to do some changes like <?php echo _e( of_get_option('home_tagline'), 'wpex'); ?> instead of <?php echo of_get_option('home_tagline'); ?>. After these changes the translate strings were loaded automatically.
    I don’t know if this is a proper way to solve this issue, especially because all the changes in template-home.php can be easily lost, but I could not come up with anything better than this.
    As for the language selector, I haven’t found a solution yet… I need some Chouby’s magic here!

    Plugin Author Chouby

    (@chouby)

    Also on my quick test I couldn’t even enable the menu language switcher because the language switcher tab with the checkbox doesn’t appear in Appearance –> Menus –> Edit Menus.

    Did you check that it is enabled in the screen options?

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘Polylang and latest Pytheas theme’ is closed to new replies.