Giter Club home page Giter Club logo

wpml-to-polylang's Introduction

Welcome to the Polylang repository on GitHub. Here you can browse the source, discuss open issues and keep track of the development.

If you are not a developer, we recommend to download Polylang from WordPress directory.

Before starting, make sure that you have the following software installed and working on your computer:

  1. A local WordPress (6.2 or later) instance
  2. Git to clone the Polylang repository (or your fork of the Polylang repository).
  3. Node.js which provides NPM. They are both required by Webpack that Polylang uses to build and minify CSS and javascript files. We recommend to install Node.js LTS version.
  4. Composer because Polylang uses its autoloader to work and it is required to install development tools such as PHP CodeSniffer that ensures your code follows coding standards.

The simplest way is to clone locally this repository and build it directly in your local WordPress instance by following the steps below:

  1. Go to your local WordPress instance wp-content/plugins/ folder:
    cd your/local/wordpress/path/wp-content/plugins
  2. Clone there the polylang repository (or your fork) from GitHub:
    git clone https://github.com/polylang/polylang.git
  3. Go to your local Polylang clone folder from there: cd polylang
  4. Run the composer command: composer build
  5. Activate Polylang as if you had installed it from WordPress.org:
    See https://wordpress.org/plugins/polylang/#installation

Note: we recommend for Windows users to use Git Bash provided with Git for Windows instead of the command or powershell terminal.

wpml-to-polylang's People

Contributors

chouby avatar manooweb avatar screenfeed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wpml-to-polylang's Issues

Media translation option incorrectly imported

  1. Setup a site with WPML with translated media.
  2. Run WPML to Polylang. The media are correctly imported and translated.
  3. Go to Languages > Settings and deactivate the media translation.
  4. Visit the media library. The languages are still there. The media translation is not deactivated as expected.

Add throtteling to the queries

I have a site with over 20k posts/pages/cpts and just as many taxonomies.

I have my max_allowed_packet set to 60MB and this naturally failed. I increased it to 512MB then 1GB and it still fails. This is something that can easily be controlled by this plugin.

Instead of making multiple massive queries, how about you break it up into multiple smaller queries? Given you have an array already, it wouldn't be hard to chunk it out and make that massive query multiple smaller queries.

I will see about adding a PR for this. It should not be expected to modify MySQL config just for an import process then to have to change it back. Having a very large max_allowed_packet (which the max is 1GB anyways) is not ideal and has numerous other concerns.

For example, I cannot get past:

// Get WPML translations.
$results = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}icl_translations" );

Since it returns over 800,000 records and even with 2GB of memory, it crashes with an out of memory error and this is just the beginning. Between memory and max_packet_size constraints, this is not ideal. Pagination would make the only requirement needed to be memory which is acceptable.

The requirements are a bit over the top for this since it looks like everything is done in a single query (why? this is not good) and there are numerous unnecessary $wpdb->prepare statements which is not efficient nor needed (being done on data fresh from the DB and some are just integers).

No way to tell the status of the import when behind a proxy

There currently is no way to tell if the import is complete, in-progess, or had an issue when you use a proxy.

A lot of local development done with docker uses nginx-proxy as a way to have dns names and SSL certs work for local development. Also, any deployment done behind a load balancer will have the same issue.

This is due to proxy timeouts which are typically 30 seconds. You will then be shown a 504 Gateway Timeout error. Yes, this is still processing in the background but there is no way to know when it is complete.

I would propose using AJAX requests to check the status of the import and show that to the user in the admin page. This is better than just submitting the POST to the same file.

I am currently working on #9 but will tackle this after as this is not very scalable or usable with proxys.

It may be best to hand this off to the cron to handle this task.

0 stored as translated post id

According to polylang/polylang#378, the migration process could create translation groups with some ids set to 0. For example:

array(2) {
  ["en"] => int(2632)
  ["es"] => int(0)
}

They should be filtered out to later avoid some notices in Polylang.

Custom terms language information

After following the instructions to migrate from WPML to Polylang with this plugin, I've encountered an issue where WooCommerce attributes (pa_X taxonomies/terms) do not get fully migrated correctly.

For example, I have a attribute Kivi (pa_kivi - means actually Stone for reference):
https://share.konekt.ee/i/6k9kDT

Currently activated (and default) language is Estonian. As you can see from the picture, first two terms are "Agate" and third is "Ahhaat". Third one (Ahhaat) is original, Estonian. Second one is actually English translation of the third one. Weird is that it shows EN_US flag there, but it's listed in Estonian. First one is just a mistake :)

Interesting enough, when I open the second one (Agate), and set language to ENG, then it recognizes and prefills translations that it may have:
https://share.konekt.ee/v/aBn5ju

Also from there you can see that when I open the Agate, you can see RUS translation attached to it. However, after setting term language to ENG, it loses that connection.

This issue has been at least two times (different WooCommerce shops) with both pa_ (attribute) taxonomies and Product Category taxonomy.

Plugin not working with Wp multisite + WPML + Polylang

I have setup a WordPress multisite environment with WPML for 4 languages (English default) and Polylang (purchases) with latest version.

I import the WPML articles in Polylang with your plugin successfully. But when I check the admin, translations are not related to each other. Means each translation work as an individual article.
For example: In admin, there are 4 homepages and each home page work as an individual. When go to setting> reading and set Home page as landing page then an error message is showing that I need to translate the page first whereas page is already translated in all language. Seems translated pages are not related to each other.

I am using below versions of each one: WP: Latest - 4.7.5 WPML: 3.5.3.1 Polylang: latest version

Anyone please look into this and help me.

ACF relationship fields in options page not imported

Most things get imported, but this is excluded.

As ACF options pages is very common, could we get a fix that this, so it gets imported and migrated correctly?

Last time I checked it all went good except for the Options pages. In my case a relationship fields within an ACF options page.

@Chouby FYI

PHP notice when running the WPML importer tool

Plugins activated

WPML to Polylang 0.3
Polylang 2.6
WPML Multilingual CMS 4.2.7.1
WPML String Translation 2.10.5.1
WPML Media 2.5.2

Issue description

After running the WPML importer tool I get a PHP notice, see:

PHP Notice:  Undefined offset: 12 in /wordpress/wp-content/plugins/wpml-to-polylang-master/wpml-to-polylang.php on line 341
PHP Stack trace:
PHP   1. {main}() /wordpress/wp-admin/admin.php:0
PHP   2. do_action() /wordpress/wp-admin/admin.php:253
PHP   3. WP_Hook->do_action() /wordpress/wp-includes/plugin.php:465
PHP   4. WP_Hook->apply_filters() /wordpress/wp-includes/class-wp-hook.php:310
PHP   5. WPML_To_Polylang->tools_page() /wordpress/wp-includes/class-wp-hook.php:286
PHP   6. WPML_To_Polylang->import() /wordpress/wp-content/plugins/wpml-to-polylang-master/wpml-to-polylang.php:96
PHP   7. WPML_To_Polylang->process_post_term_translations() /wordpress/wp-content/plugins/wpml-to-polylang-master/wpml-to-polylang.php:204
PHP Notice:  Trying to get property 'term_id' of non-object in /wordpress/wp-content/plugins/wpml-to-polylang-master/wpml-to-polylang.php on line 341
PHP Stack trace:
PHP   1. {main}() /wordpress/wp-admin/admin.php:0
PHP   2. do_action() /wordpress/wp-admin/admin.php:253
PHP   3. WP_Hook->do_action() /wordpress/wp-includes/plugin.php:465
PHP   4. WP_Hook->apply_filters() /wordpress/wp-includes/class-wp-hook.php:310
PHP   5. WPML_To_Polylang->tools_page() /wordpress/wp-includes/class-wp-hook.php:286
PHP   6. WPML_To_Polylang->import() /wordpress/wp-content/plugins/wpml-to-polylang-master/wpml-to-polylang.php:96
PHP   7. WPML_To_Polylang->process_post_term_translations() /wordpress/wp-content/plugins/wpml-to-polylang-master/wpml-to-polylang.php:204

After running the migration the language flags are missing

Plugins versions

WPML to Polylang 0.2.4
Polylang 2.3.8
WPML 4.0.5
Twenty Seventeen

Issue description

After running the migration the language flags are not displayed in the language table and in the other Polylang interface (language column, polylang metabox). A quick fi is to edit the language and assign it the relevant flag.

Steps to reproduce the issue:

  1. On your migration site de-activate WPML
  2. Activate Polylang and WPML to Poylang.
  3. Go in Tools -> WPML Importer: all the checks must passed (OK)
  4. If all the checks are passed then click on ‘Import’
  5. Go to Languages > Languages table: the flags are missing in the language table.

WPML Language order

I am adding this information here since I see this in the code:

// FIXME WPML defines a language order ( since 2.8.1 ) http://wpml.org/2013/04/wpml-2-8/.
// This is lost as I don't know how it is stored.

The language order is saved in the options table under icl_sitepress_settings. There is a key for languages_order and this is where the language order is saved.

It'll look like (I have Spanish as the primary language):

 [languages_order] => Array
        (
            [0] => es
            [1] => en
        )

Duplicate Posts now seen when import is complete

Hello,

It seems there are duplicate posts created when the import is complete.

These duplicate posts are translated posts from WPML.

Is this expected? Is this plugin still being developed?

I was expecting this to associate the translations to the post but that does not seem the case.

I am unsure if this is a bug or if this is expected behavior.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.