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

WPML: Add custom fields to the config #7588

Merged
merged 3 commits into from
Apr 12, 2024
Merged

Conversation

merkushin
Copy link
Member

@merkushin merkushin commented Apr 11, 2024

There were a number of fields without configuration.
I started with answers to make them translatable — that helped with question translation.

Proposed Changes

  • Add custom fields to the config[
  • Translate the product ID if possible.

Testing Instructions

  1. Create a multiple choice question.
  2. Create translation for the question.
  3. Make sure you see the question title and the answers in the WPML translation editor.
  4. Check translated question has translated strings.

Longer test scenario

  1. Follow our documented testing instructions.
  2. Instead of editing questions in the translated lesson, go to the original questions and click on "pencil" to edit translations for the target language.
  3. Go to frontend and check you see translated questions in the quiz.

Translated Product ID Testing Instructions

  1. Install and activate WPML, Sensei Pro, WooCommerce, WooCommerce Multilingual & Multicurrency.
  2. Follow their instructions to set up properly.
  3. Create an original course with lessons. (You can just create a new course, choose the default layout with default 3 lessons and publish it — content doesn't matter.)
  4. Go to Course Settings in the sidebar.
  5. In the Pricing section, create a new product and assign the course to that product.
  6. Go to Products, find "Translate WooCommerce products" in the filters section above the product list and click it.
  7. Create translation for the product you created on the step 5.
  8. Now go to Sensei LMS -> Courses. Click on the "plus" button to create a translation for the course from the step 3.
  9. Follow WPML instructions in the WPML editor.
  10. Open the translated course and check Course Settings > Pricing.
  11. Make sure your translated course is assigned to the translated product.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@merkushin merkushin added No Changelog WPML Compatibility issues with WPML labels Apr 11, 2024
@merkushin merkushin added this to the 4.23.1 milestone Apr 11, 2024
@merkushin merkushin self-assigned this Apr 11, 2024
Copy link

Test the previous changes of this PR with WordPress Playground.

@merkushin merkushin requested a review from a team April 11, 2024 02:55
@merkushin merkushin marked this pull request as ready for review April 11, 2024 02:56
Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link
Collaborator

@donnapep donnapep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kinda worked for me, only didn't. 😅 I started by creating an English MCQ question. When I clicked + to add a Spanish translation, the answers as well as the answer feedback was shown in the WPML translation editor. When I opened the Spanish question though, the answers were empty:

Screenshot 2024-04-11 at 8 06 13 AM

Then when I tried to test again with a new question, I was no longer seeing the answers in the translation editor. There's nothing in the WPML logs but an "Unable to authenticate" error.

What should I be testing for the product ID?

includes/wpml/class-custom-fields.php Outdated Show resolved Hide resolved
Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link
Member

@m1r0 m1r0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing there was some caching because the answer translation worked fine only after the second try.

The product relation field worked as well. 👍

@merkushin merkushin merged commit 16178aa into trunk Apr 12, 2024
23 checks passed
@merkushin merkushin deleted the fix/wpml-custom-fields branch April 12, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Changelog WPML Compatibility issues with WPML
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants