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

Translation errors #1644

Merged
merged 11 commits into from
Jul 24, 2023
Merged

Translation errors #1644

merged 11 commits into from
Jul 24, 2023

Conversation

amieiro
Copy link
Member

@amieiro amieiro commented Jun 27, 2023

Problem

We have some situations where we don't check some translations or if we check it, we return a warning, that can be dismissed by the translator, so the translators can add incorrect, and sometimes, dangerous translations. Some examples:

Fixes #1546.

Solution

This PR adds two classes, to be able to add some checks in the GlotPress core, and another ones in an external plugin, because sometimes the error checks are very specific to the project (e.g., WordPress core).

This PR adds in the core the Incorrect placeholder check.

The end users will receive an error, so they can't dismiss the message, so with this update we will be sure that we check some big translation problems and the translator can't dismiss the message.

To-do

  • Create an external plugin, at translate.w.org, to add some checks for the WordPress core:
    • Check the unexpected timezone.
    • Check the unexpected start of the week.
    • Check the unexpected date format (year, month, day).
    • ...

Testing Instructions

Before start testing, please, compile the assets executing:

npm install
npm run build

This PR add some unit tests in the tests/phpunit/testcases/test_builtin_errors.php file. To execute only these tests, you cas run

phpunit --filter GP_Test_Builtin_Translation_Errors

To execute all the tests, you can run

phpunit

To test the incorrect placeholder check in the UI, you can:

  1. Open an original string in a project.
  2. Add the Yo! We so great! 100% bug free! <a href="%s">Check it!</a> translation.
  3. Click on the "Add translation" or "Suggest" button, depending on your role.
  4. You will get an error in the UI and you can't save the translation.

image

Screenshots or screencast

@amieiro amieiro marked this pull request as ready for review June 30, 2023 16:51
@amieiro amieiro requested review from akirk and trymebytes June 30, 2023 16:51
trymebytes
trymebytes previously approved these changes Jul 6, 2023
Copy link
Contributor

@trymebytes trymebytes left a comment

Choose a reason for hiding this comment

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

Tested and works as expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable translation warning discard for unexpected additional printf placeholders
3 participants