Support » Plugin: Polylang » Theme's homepage strings translation

  • Resolved lucabarbetti


    Polylang and Pytheas (free theme by A.J. Clark/WPExplorer), which uses the plugin Options Framework, work pretty well together out of the box, Polylang recognizes and manages well all the custom types that Pytheas introduces (slider, portfolios and highlights, they all work great).
    The only problem is with the strings that the theme introduces in the homepage and that are set by the admin via the theme’s options page.
    I have been reading all the posts related to this subject, strings translation, themes translation, custom post types translations, been google-ing for days, but I can’t get my head around this.
    Following all the examples and snippets of codes found, I have used a custom plugin (similar to this ) but it hasn’t worked; I have added code in functions.php to register the strings (pll_register_string) and in the theme’s files to translate (pll__)the strings, and the best I could get to was a Settings->Languages->String Translations page with the new strings but they would be scrambled at every save and they would not appear translated in the homepage.
    Sorry to bring up this strings translation problem again, with all the snippets of code and examples that I could find, I’m sure that a skilled programmer could easily solve it, but unfortunately this doesn’t look like a ‘for dummies’ thing… or, maybe, I’m dummier than the regular dummy!
    Thanks a lot

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


    First update to the current development version ( as I found a bug in 1.0.3 which will prevent the solution below to work.

    Then create a file called wpml-config.xml with the following content:

            <key name='options_wpex_themes'>
                <key name='home_tagline' />
                <key name='home_highlights_title' />
                <key name='home_portfolio_title' />
                <key name='home_blog_title' />

    Then upload the file in the /wp-content/polylang/ directory (you must create it).

    It works! 🙂
    You are a hell of developer, thanks, thanks, thanks a lot!

    P.S. out of curiosity, which is the best/safest way to manually update Polylang?

    Plugin Author Chouby


    The way I use: create a ‘temporary’ directory in plugins directory, upload Polylang files in it, delete the old ‘polylang’ directory, rename the ‘temporary’ directory to ‘polylang’.

    Thus, the plugin is always available except between the ‘delete’ and ‘rename’ operations, which should be very short.

    Ok, it sounds good, next time I’ll try that.
    I asked because last night I did it the classic way, that is: deactivate, delete, add-new and activate, but I had to reassign the language to all the posts/pages/custom-posts and in some cases to manually pair them again.
    Thanks a lot, have a great weekend!

    Plugin Author Chouby


    If you click on the “red” delete link, Polylang will intentionally remove all its data from the database. Otherwise, if you only de-activate and re-activate, all data should be kept.

    Got it… just tried it and all data is kept indeed.

    This is GREAT! thanks!

    In my case it works perfectly for one of the plugins that need to be translated which fields show as single records at wp_options, but not for my theme settings fields which is an array within a record from wp_options as well.

    I put the wpml-config.xml file below at my child theme root folder and the result is:

      The first section works fine.
      The sub-section from “pitch_theme_settings” doesn’t even show.
    		<key name="wp_cart_title" />
    		<key name="wp_cart_empty_text" />
    		<key name="wp_cart_visit_shop_text" />
    		<key name="plural_items_text" />
    		<key name="singular_items_text" />
    		<key name="shipping_text" />
    		<key name="item_name_text" />
    		<key name="price_text" />
    		<key name="remove_text" />
    		<key name="item_qty_string" />
    		<key name="no_item_in_cart_string" />
    		<key name="pitch_theme_settings">
    			<key name="front_page_cta_text" />
    			<key name="front_page_cta_button_text" />
    			<key name="front_page_home_title_latest_projects" />
    			<key name="front_page_home_title_blog" />
    			<key name="front_page_home_title_clients" />
    			<key name="project_archive_title" />
    			<key name="project_view_text" />
    			<key name="text_footer_text" />
    			<key name="text_search_placeholder" />
    			<key name="text_comments_closed" />
    			<key name="text_not_found" />

    Is there any requirement to handle these arrays or is just not previewed.

    If it doesn’t handle any turn around? This section is what is left to have the site 100% translated.

    Looking to hear from Chouby

    Didn’t notice this topic was resolved and I guess my problem isn’t with wpml-config.xml file but with the theme.

    I’ve opened a new topic here:

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Theme's homepage strings translation’ is closed to new replies.