Polylang 1.4 beta

I firstly wish you all a very good year 2014!

I did not have the time to include all the UI improvements I wanted in Polylang 1.3 since I wanted this version out for the release of WordPress 3.8. So here comes a development version of Polylang 1.4 which focuses on an improvement of the translations management in the languages metabox. The post ids are now replaced by the list of untranslated posts in that language, which should make the translation management much more convenient.

There is also an attempt to better support the featured content tag of Twenty Fourteen. Of course this tag has to be translated to benefit of all the functionalities.

Under the hood, the function ‘get_pages’ is now filtered and various performance improvements have been made. Also, for pre v1.2 users, this version will manage the deletion of old data in a safe way (during an upgrade, at least 60 days after update to v1.4). It is also important to notice that the minimum WordPress version is now WP 3.5.

Download Polylang 1.4 beta

Advertisements

35 thoughts on “Polylang 1.4 beta

  1. RavanH

    The post ids are now replaced by the list of untranslated posts in that language, which should make the translation management much more convenient.

    Fantastic news! Will be testing it asap 🙂

    1. RavanH

      First impressions: Looks much cleaner and user friendly. Dropdown shows all ‘available’ posts which makes it all very natural and easy to use. Works very well. Love it!

      1. RavanH

        One very very small thing: with debugging on, I get a “Notice: unserialize(): Error at offset 0 of 574 bytes in /xxx/xxx/xxx/wp-content/plugins/polylang/include/mo.php on line 60″…

      2. Frédéric Post author

        😦 This error has already been reported (at least one time) in the support forum. It should occur after an upgrade from v1.1.6 or older. That means probably that strings translations were not correctly upgraded. You should check that and also if everything else is ok. v1.2 really changed a lot of things. That’s why I recommended a DB backup, although there is a revert procedure which works quite well

        The most annoying thing is that up to now, I did not succeed to fire this error during my upgrade tests and did not figure out why it occurs.

      3. RavanH

        That’s interesting… I tested the dev version on a test site where I had 1.3 before but I unsintalled that one first. After installing 1.4dev all language settings had been cleared and I had to configure some languages and some posts again. Want me to start with 1.3 again and then do an upgrade via FTP to see if the notice remains?

      4. Frédéric Post author

        Interesting yes. And it seems that it has nothing to do with old upgrade as I believed. So if I well understand, you removed all Polylang data before testing the development version. The posts containing the strings translations (post_type: “polylang_mo”) should be removed during the uninstall procedure. And they should be created only after the first time you save strings translations. I just checked that and everything works as expected without notice on my test site.

        Want me to start with 1.3 again and then do an upgrade via FTP to see if the notice remains?

        Thanks but that should not be useful as almost nothing happens during this upgrade (I just delete the language cache and set a transient to prepare pre-1.2 data removal).

      5. RavanH

        On http://www.php.net/manual/en/function.unserialize.php it reads “In case the passed string is not unserializeable, FALSE is returned and E_NOTICE is issued.” I suspect this is what’s happening.

        When exactly would you expect $post->post_content to be serialized data?

        In any case you could use the WordPress function is_serialized to check this: replacing the if (!empty($post)) with if (!empty($post) && is_serialized($post->post_content) ) solved the notice on my test site.

      6. Frédéric Post author

        The post content is serialized in the function just above at line 44, called when you save the strings translations. Yes using ‘is_serialized’ will hide the notice. But that would be preferrable to understand why it is not correctly serialized. Are your strings translations correctly saved?

      7. RavanH

        Ehm… I’m not completely following you here.

        Are all posts and pages converted to a post type called ‘polylang_mo’ (with serialized post_content) when activating Polylang? If not, that would explain why after a clean install (with all post_content as regular text blobs) this notice appears… Or am I misunderstanding the use of this post type?

      8. Frédéric Post author

        No, all post types are kept as they are. The ‘polylang_mo’ post type is used to store strings translations (those saved using settings->languages->strings translations). Before v1.2 I used the options table, but I moved to a custom post type to allow exporting strings translations with the export tool 🙂

        So at most, there is one ‘polylang_mo’ post per language. It is created when the strings translations are saved for the first time. Of course I test for the existence of this post before attempting to do anything. And the post should always be saved with serialized content.

      9. RavanH

        OK, now I understand better. I looked in my database but found no posts of this post type. And if I add something like print_r( $post->post_content ); before the line that throws the notice, it prints the current post/page content instead of nothing (like I would expect when there is no post of this polylang_mo post type)…

        It is created when the strings translations are saved for the first time.

        But indeed after saving the strings translations page, four posts of the polylang_mo post type appear in the database and the notice is gone. And the print_r blurts out the expected serialized data.

        Of course I test for the existence of this post before attempting to do anything.

        So it looked like this check was failing but after deleting these new polylang_mo posts from the database again, the notice did not come back. Strange…

        Maybe the extra is_serialized($post->post_content) check then?

      10. Frédéric Post author

        it prints the current post/page content instead of nothing (like I would expect when there is no post of this polylang_mo post type)

        You got it! Thank you. I should not test the existence of the post but the existence of the post id instead!

    2. matob

      When i try activate Polylang 1.4dev15 error occurs:

      Fatal error: Call to a member function home_url() on a non-object in /***/wp-content/plugins/polylang/include/language.php on line 101

    1. Frédéric Post author

      WordPress does not allow using the same slug for different posts. And Polylang uses a post per translation. This topic refers to a workaround proposed by Andydegroo (that may need to be adapted as internals of Polylang have changed). But nothing is planned to implement this in Polylang as I still did not find a workaround for taxonomies.

      1. matob

        WPML has this functionality and works on the same principle… i think 😉 How they solve this problem?

  2. matob

    Error on my theme:
    Warning: Illegal offset type in isset or empty in /web/wp-includes/pomo/translations.php on line 72

      1. RavanH

        Wondering how I could get the unserialize(): Error at offset 0 notice back, I applied these steps to reproduce:
        1. Deactivate and unsintall Polylang 1.4dev14 (which did not show the notice anymore after having saved the string translations)
        2. Install the dev 1.4dev15 version via Plugins > Add New upload tab and activate
        3. Define at least one language at Settings > Languages and visit any post or page on the font-end… with WordPress in the DEBUG mode, obviously 😉

    1. DarkPSart

      I have the same error. However, I fixed it by changing from
      return isset($this->entries[$key])? $this->entries[$key] : false;
      to
      if(!is_array($key))
      return isset($this->entries[$key])? $this->entries[$key] : false;
      in wp-includes/pomo/translations.php because some $key is an array

  3. 香腸

    Hi,
    I have translated Traditional Chinese language file (zh_TW), but does not know how to submit to you?

    Please tell me how to send you, thank you!

  4. kashanhelp@gmail.com

    hi i am in a very huge problem i am trying to change the string translations but no translation is changiing i was having this problem with the 1.3.1 then i change to 1.4 to see if may be problem get resolve i try to change string translations for different languages but when i click on save or bulk action apply it comes all old same translation remeber that the only tranlation in all strings is comming in english suppose i chante find us facebook in spanish and urdu language in three different boxes but no benifit when i click save again same find us on facebook came back and no difference any suggesiton please help ? my theme is responsive theme

Comments are closed.