Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Polylang #2284

Open
Tracked by #2231
jonathanbossenger opened this issue Mar 5, 2024 · 52 comments · Fixed by #3049
Open
Tracked by #2231

Test Polylang #2284

jonathanbossenger opened this issue Mar 5, 2024 · 52 comments · Fixed by #3049

Comments

@jonathanbossenger
Copy link
Collaborator

jonathanbossenger commented Mar 5, 2024

Front-end requirements:

  • Language selector does not show as country flags. (Many countries speak multiple languages, so describing a language with a flag should be avoided.)
  • Languages can be changed without needing to log in to one's WordPress.org account.
  • Once a language is selected, it is applied globally.
  • Content of the selected language is shown above non-translated content.
  • English content is still shown where translations don't exist.

Back-end requirements:

  • Translators do not have permission to create or publish new content.
  • Translators have permission to both translate any content, and review content translated by others.
  • A flow can be implemented where translations must be approved (reviewed) before published.
  • Sensei content types can be translated in the same way as native post types.
  • Taxonomies can be translated.
  • Translated content is indexed and searchable by Jetpack Search.
@jonathanbossenger
Copy link
Collaborator Author

@cynthianorman feel free to leave your testing feedback here.

@jonathanbossenger jonathanbossenger changed the title Test Polylang for translation Test Polylang Mar 5, 2024
@cynthianorman
Copy link
Contributor

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

@cynthianorman
Copy link
Contributor

@cynthianorman
Copy link
Contributor

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
Copy link
Contributor

@cynthianorman
Copy link
Contributor

cynthianorman commented Mar 16, 2024

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
Copy link
Collaborator Author

jonathanbossenger commented Mar 26, 2024

@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
Copy link
Collaborator Author

jonathanbossenger commented Mar 26, 2024

Front-end requirements:

  • Language selector does not show as country flags. (Many countries speak multiple languages, so describing a language with a flag should be avoided.)
  • Languages can be changed without needing to log in to one's WordPress.org account.
  • Once a language is selected, it is applied globally.
  • Content of the selected language is shown above non-translated content.
  • English content is still shown where translations don't exist.

Back-end requirements:

  • Translators do not have permission to create or publish new content.
  • Translators have permission to both translate any content, and review content translated by others.
  • A flow can be implemented where translations must be approved (reviewed) before published.
  • Sensei content types can be translated in the same way as native post types.
  • Taxonomies can be translated.
  • Translated content is indexed and searchable by Jetpack Search.

@cynthianorman
Copy link
Contributor

@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
Copy link
Collaborator Author

Perfect, thank you so much!

@jonathanbossenger
Copy link
Collaborator Author

@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
Copy link

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
Copy link
Collaborator Author

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
Copy link

sebastienserre commented Sep 19, 2024

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
Copy link
Collaborator Author

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.

2024-10-02.15-30-25.mp4

@jonathanbossenger
Copy link
Collaborator Author

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

Thanks

@sebastienserre
Copy link

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

@jonathanbossenger
Copy link
Collaborator Author

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

@jonathanbossenger
Copy link
Collaborator Author

I'm happy to do that if that works best for everyone involved.

@sebastienserre
Copy link

Hello,

I'm going to see with Polylang's founder if it's reasonable to expose our Pro plugin (Unique surce of revenue for our company) in a public Github repository.

Regards

@jonathanbossenger
Copy link
Collaborator Author

@sebastienserre it might be helpful here to confirm if Learn actually needs the pro version of the plugin.

As far as I can tell, all we need to be able to do is create translated versions of courses, modules, and lessons with support for a language switcher. Correct me if I am wrong, but this is part of the core plugin available on the .org directory.

@sebastienserre
Copy link

@jonathanbossenger Site Editor, block editor is managed by Polylang pro, not Polylang.
I've checked internally and this is OK to versioned Polylang Pro. If it's easier for every one, it's OK for us.

@adamwoodnz
Copy link
Contributor

block editor is managed by Polylang pro, not Polylang

Sorry, but to be clear; we use the block editor for Courses and Lessons, so does that mean we need Pro?

I didn't quite appreciate that we would be open sourcing your Pro code with this approach 🤦 Thanks for checking, and making this possible.

Dion is currently on leave, so I'd like to await his return and opinion on this.

@sebastienserre
Copy link

Yes you need Polylang Pro.
In a WordPress world, the code is GPL. What we're selling is my job which is support :).
I spoke today with my manager (https://github.com/Chouby) who is the Polylang founder. There's no problem, Polylang Pro is already available on some public GH

@jonathanbossenger
Copy link
Collaborator Author

Thanks for checking and sharing the update @sebastienserre.

@adamwoodnz I will create the PR this week and ping you here once it's ready.

@dd32
Copy link
Member

dd32 commented Nov 26, 2024

This would mean it wouldn't be available for other .org sites, only Learn, which might be desirable. @dd32 what do you think?

Learn is deployed into the same network that all other WordPress.org sites are in, so the plugin would be available to them, just not activated.

The main reason to include the Pro source in the GitHub repo is if you need it for local development sites of Learn, otherwise we can safely deploy it straight to WordPress.org without it going through this repo. That's why Sensei Pro is included AFAIK, because it was needed for local development and the free version didn't provide the same experience.

If you can share the code with me when you've got it, I can run it against the internal plugins tooling to ensure that no issues are flagged.

@dd32
Copy link
Member

dd32 commented Nov 26, 2024

If you can share the code with me when you've got it, I can run it against the internal plugins tooling to ensure that no issues are flagged.

Just noting that I've run the latest version of Polylang Pro 3.6.5 through the scanners I have access to, and nothing is being flagged as needing extra review, so I consider this good to deploy.

@adamwoodnz
Copy link
Contributor

@jonathanbossenger if you could proceed with the PR I can add any necessary tooling changes for deployment, thanks all.

@jonathanbossenger
Copy link
Collaborator Author

Thanks, everyone. I'll create the PR and tag @adamwoodnz for the review.

@jonathanbossenger
Copy link
Collaborator Author

Adding a note that we need to add the wpml-config.xml to the wporg-learn-2024 theme with the following content, once the plugin is merged.

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

@jonathanbossenger
Copy link
Collaborator Author

jonathanbossenger commented Dec 2, 2024

@adamwoodnz created #3049 to merge the Polylang Pro code.

I'll DM you the training team canvas with the logins.

@jonathanbossenger jonathanbossenger linked a pull request Dec 2, 2024 that will close this issue
adamwoodnz added a commit that referenced this issue Dec 3, 2024
* Adds the Polylang Pro plugin to Learn.WordPress.org

See #2284

* Add Polylang Pro to build

* Reconfigure gitignore for build directories

* Add polylang pro frontend assets

---------

Co-authored-by: Adam Wood <1017872+adamwoodnz@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this from In Progress to Done in LearnWP Website Development Dec 3, 2024
@adamwoodnz
Copy link
Contributor

Adding a note that we need to add the wpml-config.xml to the wporg-learn-2024 theme with the following content, once the plugin is merged.

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

Still need to do this, and test on https://learn.wordpress.org/test/

@adamwoodnz
Copy link
Contributor

adamwoodnz commented Dec 4, 2024

The plugin is activated on the test site with 2 languages: https://learn.wordpress.org/test/wp-admin/admin.php?page=mlang

Have a play and let me know what further code changes we need 🙂

cc @kaitohm

@kaitohm
Copy link
Contributor

kaitohm commented Dec 4, 2024

Thanks, will look into this 👀

@jonathanbossenger
Copy link
Collaborator Author

Thanks @adamwoodnz

@kaitohm when you're testing this, this video includes the process I followed to translate content.

I will also make a point to look into this later this week.

@adamwoodnz adamwoodnz moved this from Done to In Progress in LearnWP Website Development Dec 4, 2024
adamwoodnz added a commit that referenced this issue Dec 4, 2024
Adds a WPML config file for Polylang Pro, see #2284 (comment).

See #2284
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

6 participants