WordPress / Learn

WordPress.org Learn - The canonical source for the code and content behind https://learn.WordPress.org
276 stars 101 forks source link

Test Polylang #2284

Open jonathanbossenger opened 8 months ago

jonathanbossenger commented 8 months ago

Front-end requirements:

Back-end requirements:

jonathanbossenger commented 8 months ago

@cynthianorman feel free to leave your testing feedback here.

cynthianorman commented 8 months ago

Successfully installed on Learn WordPress local dev env https://drive.google.com/file/d/1FhK_aov9Ut8Plex77k8LbDFTWdIGs90A/view?usp=drive_link

cynthianorman commented 8 months ago

Consider upgrading at some point to Pro https://drive.google.com/file/d/1Jj_F4M59J4P52NTM1bk4bEKFO-WFLRDs/view?usp=drive_link

cynthianorman commented 8 months ago

We can select the languages we want to translate pages and posts to https://drive.google.com/file/d/1npTZ3t9k9rWnaFMiVKHordb8YcKumMhF/view?usp=drive_link

Note that showing the flag in the front end is optional

cynthianorman commented 8 months ago

You can create translated menus https://drive.google.com/file/d/1pvQYi1QSD5u3pTduH3G1K1rxpinK_P5v/view?usp=drive_link

cynthianorman commented 8 months ago

We assign a language to a page or post https://drive.google.com/file/d/1QLN53RIfDCOAZlsqHBYE0NWbdLIJ82c-/view?usp=drive_link https://drive.google.com/file/d/1y92lEZv_rpNSI6BZy_s34wCuoel8A8uD/view?usp=drive_link https://drive.google.com/file/d/1HT_XT9a9XGh7g5w6mDBXNrMRO4AlUqNQ/view?usp=drive_link

Note, we are able to do the same thing with courses https://drive.google.com/file/d/1VegkHlSONpCsF5Oh6DfQVu9f4pSDn6ex/view?usp=drive_link

cynthianorman commented 8 months ago

It's important to know that we essentially build a separate set of pages/posts/taxonomies and corresponding menu for each language.

For this reason, we would need to create the copied English page/post and designate it as French (for example) otherwise I don't believe this will work out for us. In other words, the copied English page/post would act as a placeholder until a translator would contribute the translation.

https://drive.google.com/file/d/1ZLAMfGTc4nOa6Cl9Wdgo5BFpZEiBf4KR/view?usp=sharing

jonathanbossenger commented 7 months ago

@cynthianorman do you think you'd be able to update this issue with a summary of your findings, in a similar way as the WPML test?

Edit, I've prepared the list in the comment below, so you just need to mark off the relevant items.

This will allow me to prepare a summary comparison table of our test findings for the training team meeting on Thursday.

jonathanbossenger commented 7 months ago

Front-end requirements:

Back-end requirements:

cynthianorman commented 7 months ago

@cynthianorman do you think you'd be able to update this issue with a summary of your findings, in a similar way as the WPML test?

Edit, I've prepared the list in the comment below, so you just need to mark off the relevant items.

This will allow me to prepare a summary comparison table of our test findings for the training team meeting on Thursday.

ok @jonathanbossenger done

jonathanbossenger commented 7 months ago

Perfect, thank you so much!

jonathanbossenger commented 2 months ago

@sebastienserre I have been testing PolyLang this week, and I have encountered a blocker that I hope you can help resolve.

Learn.WordPress.org uses Sensei LMS to manage our course content: https://wordpress.org/plugins/sensei-lms/

Sensei allows you to create course, and then create modules within the course and lessons within the modules:

localhost_8888_wp-admin_post php_post=258770 action=edit

I am then able to navigate to individual lessons, and use the PolyLang feature to create different language versions of the individual lessons successfully:

localhost_8888_wp-admin_post-new php_post_type=lesson

However, as soon as I assign the language and link the translated version of a lesson to the English one, the relationship between the module and the lesson is broken. If I navigate back to the course edit screen, the translated lesson does not appear anymore in the module.

localhost_8888_wp-admin_post php_post=258770 action=edit (1)

Are you able to assist in determining why this is happening?

sebastienserre commented 1 month ago

Hello @jonathanbossenger Here is a quick video where I show you What I'have found. I'm not used to use Sensei and at helpdesk we do not have so much request for this plugin, so I hope I'm matching your request. https://www.loom.com/share/058116fd5b204318bf3d730f8c1b5b71

The "course" post meta seems to be synchronized between the same lesson in different language. This is due to a WPML compatibility because Polylang is compatible with the WPML API to understand plugin & theme compatibility made for this plugin. WPML API in Polylang

To stop this synchronization, you can create a wp-content/polylang/wpml-config.xml file containing

<wpml-config>
    <custom-fields>
        <custom-field action="ignore">_lesson_course</custom-field>
    </custom-fields>
</wpml-config>

If some others post_meta needs to be ignored, then _lesson_course is the meta name. https://polylang.pro/doc/the-wpml-config-xml-file/

Of course, what is done thanks to the wpml-config.xml file can also be done in PHP if the wp.org maintainers prefer.

jonathanbossenger commented 1 month ago

Hey @sebastienserre, no problem at all; I'm not used to PolyLang, so we're all figuring this out together. 😁

The "course" post meta seems to be synchronized between the same lesson in different language

That does seem to be correct, so I will test your suggestion and report back with my findings.

sebastienserre commented 1 month ago

The initial sync is made by the Sensei LMS wpml-config.xml available at their root https://plugins.trac.wordpress.org/browser/sensei-lms/trunk/wpml-config.xml

You can see lots of copied "custom fields" some other post metas are sync and may "break" your test. Adding some lines with ignore instead of copy should help. In case of doubts, I'm available.

Like WordPress with a child theme, Polylang will read first the plugin root wpml-config.xml file, then the parent theme one (if exists), then the child theme one, then check in mu-plugins folder and finally wp-content/polylang

jonathanbossenger commented 1 month ago

Hello @sebastienserre. With the suggested wpml-config.xml config in place, I am still experiencing the problem.

I have created a screen recording of what I am seeing, I hope this will help you understand what I'm experiencing.

https://github.com/user-attachments/assets/f5e7a81d-2162-4b30-87e3-88a6b99727c0

jonathanbossenger commented 1 month ago

Hi @sebastienserre I wanted to follow up here, have you been able to look into this?

Thanks

sebastienserre commented 1 month ago

Hello @jonathanbossenger I'm away a few days, I will test and answer quickly

jonathanbossenger commented 1 month ago

@sebastienserre not a problem thanks for letting me know, I just wanted to make sure you got the message.

sebastienserre commented 1 month ago

Hello @jonathanbossenger

Here are 2 videos (yes I'm not ready to contribute to learn team, I have problems to click on the correct button :) )

https://www.loom.com/share/7f4737cdf22342698e9b7198190beea8 https://www.loom.com/share/3c861d48eeca4d569f7498fe0b96cdfc

I've set up a Twenty Twenty One child theme with the wpml-config.xml file on its root.

As you can see, I do not follow exactly the same steps you're following, but the result is I have a course translated in 2 languages.

If you do not have the behaviour I have, I think a conflict is occurring... Does it work with Twenty Twenty One ?

Where can I download the learn.wp.org theme to test it ?

jonathanbossenger commented 1 month ago

Ok, thanks @sebastienserre I will review the videos next week and check against the Learn theme.

jonathanbossenger commented 3 weeks ago

@sebastienserre thanks for the feedback. I can confirm that I can translate lessons the way you have shown.

However, I'm seeing a weird thing that happens when I try to create lessons inside a module in the Course edit screen, which I think may be a Sensei related issue. I'm going to see if I can get some help with this.

jonathanbossenger commented 1 week ago

@kaitohm it looks like we might have a workable solution here. I was able to test it on a clean Sensei environment, so I just need to test it on the learn.wordpress.org local environment (which I plan to do today) and will report back here once that's done.

kaitohm commented 1 week ago

Great news! Thanks for the update 👍

jonathanbossenger commented 1 week ago

@kaitohm Ok, here is a recording of the process of translating lesson content:

https://github.com/user-attachments/assets/c68e6685-df3e-411c-8dc2-02dae481fd6e

In short, Polylang allows us to translate lesson content using the regular Lesson editing user interface and retain all the relevant course/module/lesson structures.

All we need to ensure is the following:

  1. We include a wpml-config.xml file in the Learn child theme which contains a specific rule about the _lesson_course post meta field (I have this and can create the PR)
  2. We create a specific user role for translation users who can edit/create lessons (I can work with @adamwoodnz on getting this done).

Therefore, I propose we move ahead with the next step, which would be to arrange for the code review of PolyLang to be included in the .org infrastructure in order to use it on Learn.

kaitohm commented 1 week ago

Thanks for the recording, @jonathanbossenger . This looks great! Please move forward with your suggestions above 👍

jonathanbossenger commented 1 week ago

@adamwoodnz can we start the process of having the PolyLang and PolyLang Pro code reviewed for inclusion into .org?

sebastienserre commented 1 week ago

@jonathanbossenger Polylang is included inside the Polylang Pro vendor/wpsyntex folder. No need to have both plugins on the website. (On Polylang Pro activation, Polylang is automatically deactivated)

jonathanbossenger commented 1 week ago

Ah, thanks @sebastienserre. @adamwoodnz it looks like all we need to get reviewed then is the plugin in the wordpress.org repo.

adamwoodnz commented 3 days ago

Sorry, which version are we planning to install on wordpress.org, Polylang or Polylang Pro?

jonathanbossenger commented 3 days ago

Hey @adamwoodnz, according to what @sebastienserre shared, we only need to test Polylang.

adamwoodnz commented 3 days ago

Polylang is included inside the Polylang Pro

Sounds like we'd need to install Pro, and it includes the base plugin

jonathanbossenger commented 3 days ago

Sorry @adamwoodnz I read the original message wrong. If we can test Polylang Pro please. I have a copy of the plugin code, let me know the best way to get it to you.

sebastienserre commented 2 days ago

We released Polylang Pro 3.6.5 last week to be OK with WP6.7. @jonathanbossenger you should be able to download it from your account at https:://polylang.pro/account. Let me know if you encounter any difficulties