WordPress.org

Ready to get started?Download WordPress

Forums

Translation issues using polylang (13 posts)

  1. imomi
    Member
    Posted 1 year ago #

    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

  2. Chouby
    Member
    Posted 1 year ago #

    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

    `

  3. imomi
    Member
    Posted 1 year ago #

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

  4. imomi
    Member
    Posted 1 year ago #

    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.. :]

  5. imomi
    Member
    Posted 1 year ago #

    of-course nothing happens...

  6. Chouby
    Member
    Posted 1 year ago #

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

  7. imomi
    Member
    Posted 1 year ago #

    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!

  8. Chouby
    Member
    Posted 1 year ago #

    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

  9. imomi
    Member
    Posted 1 year ago #

    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?

  10. designscopedublin
    Member
    Posted 1 year ago #

    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!

  11. Chouby
    Member
    Posted 1 year ago #

    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

  12. designscopedublin
    Member
    Posted 1 year ago #

    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!

  13. imomi
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic