WordPress.org

Support

Support » How-To and Troubleshooting » Translation issues using polylang

Translation issues using polylang

  • Hello everyone!
    Ive recently created my first wordpress site (www.epanasyndesi.gr) using “bizway” free theme.
    I managed to translate most of the content in english but I cannot find the first page anywhere. Chrome’s webkit shows that the home page is an xhtml document which I can’t find…

    Is it possible to find the main page, duplicate it, translate it in english and then give the home button the link? If not, how can I translate the home page?

    Another thing is that Polylang shows the flags on the main menu and I’d really like to find the

    • objects which hold them so that I can define some css rules using id, to give the flags a fixed position.

    Thank you in advance, Dimos

Viewing 12 replies - 1 through 12 (of 12 total)
  • Chouby
    Participant

    @chouby

    Copy paste the code from http://pastebin.com/NSBmK6he in a text file called pll_bizway.php
    Add the options you want to translate to the array ‘$to_translate’ (examine the file front-page.php of your theme to find out the options).
    Upload the file in wp_content/plugins
    Activate the plugin
    Fill the options of the theme
    Translate the options in settings->languages->strings translations

    `

    Thank you Chouby, I’ll check it out soon and respond

    Goodmorning/evening Chouby.
    There is no pll_bizway.php file on the server or locally. I’ll insert the script on polylang.php and see what happens.. :]

    of-course nothing happens…

    Chouby
    Participant

    @chouby

    You must create the file pll_bizway.php, copy paste the code and upload th file.

    Chouby, I did what you said. Created a php file and pasted your code.
    Could you please tell what kind of options do I need to enter in the array?
    I mean the main text displaying is an h1 tag.. .Wordpress’s widget positions do not exist, the only way I can edit the home page is from the backend

    Pic1 : https://www.dropbox.com/s/sju7ltg5a7ys3sz/Screen%20Shot%202012-11-10%20at%2010.51.48%20AM.png

    Pic2 : https://www.dropbox.com/s/qdxd9y3cxyclc1w/Screen%20Shot%202012-11-10%20at%2010.52.08%20AM.png

    Thanks for helping me out!

    Chouby
    Participant

    @chouby

    In the file bizway/front-page.php, you have instructions like:
    bizway_get_option('some_option')
    You can add these ‘some_option’ that you want to translate in the array $to_translate

    Ok, this is the script with the options :

    <?php
    /*
    Plugin Name: Polylang translates bizway strings
    */
    
    if (function_exists('pll_register_string'))
            add_filter('option_bizway_options', 'translate_bizway_options');
    
    function translate_bizway_options($options) {
            $to_translate = array('bizway_first_head','bizway_second_head','bizway_firsthead','bizway_firstdesc','bizway_secondhead','bizway_seconddesc','bizway_thirdhead','bizway_thirddesc');
            foreach ($options as $key=>$option) {
                    if (in_array($key, $to_translate)) {
                            if (is_admin())
                                    pll_register_string($key, $option);
                            else
                                    $options[$key] = pll__($option);
                    }
            }
            return $options;
    }

    I uploaded the file in wp_content/plugins and nothing happened.
    When I moved the file in wp_content/plugins/polylang and immediately said to install “update” so I did, but in settings->languages->strings translations there are no extra translation options.
    What am I doing wrong?

    designscopedublin
    Member

    @designscopedublin

    Hi,
    I am also trying to translate the bizway theme into other languages.
    I have created the pll_bizway.php file with the pasted code adding the other options that include the Homepage feature headings and descriptions.
    I uploaded the file to the wp_content/plugins folder and I went back to the WordPress Dashboard to see the new Plug In “Polylang translates bizway strings” and activated it. However, I went to the settings/languages/string translations and I could not find any extra translation options either. The static front page is not translated when I click on any of the polylang flags. Please Help!

    Chouby
    Participant

    @chouby

    Sorry, I made a mistake 🙁
    I updated the code (including the options added by @imomi): http://pastebin.com/NSBmK6he

    I confirm that the file pll_bizway.php must be uploaded in wp-content/plugins, not in wp-content/plugins/polylang

    designscopedublin
    Member

    @designscopedublin

    Chouby, I just want to say that that updated code in the pll_bizway and it worked! The relevant language options appeared in the settings/languages/string translations area. Thanks again!

    Im so freakin’ happy! It does work!!
    PHP magic.. thanks Chouby

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Translation issues using polylang’ is closed to new replies.