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

Rely on just-in-time translation loading #368

Merged
merged 1 commit into from
May 8, 2024
Merged

Rely on just-in-time translation loading #368

merged 1 commit into from
May 8, 2024

Conversation

swissspidy
Copy link
Contributor

@swissspidy swissspidy commented May 1, 2024

Context

The plugin was loading translations too early on plugins_loaded. Plugins should wait until init to ensure the current user has been set up, so that the current user's locale can be respected.

That said, why manually load translations when WordPress can do it for you :-)

Summary

This PR can be summarized in the following changelog entry:

  • Improves how the translations are loaded by relying on the WordPress mechanism for that. Props to @swissspidy.

Relevant technical choices:

  • See above

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Set a language which has 100% of the translations (see the list)
  • visit Settings > Duplicate Post and check that all the strings are translated
  • visit the Post list and check that the row actions, the bulk actions and the column header are translated
  • edit a post and check that the "Copy to a new draft" and "Rewrite and Republish" button are translated
  • also check that the admin bar menu is translated
  • also check that the plugin entry in the plugin list is translated

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities
  • I have added unittests to verify the code works as intended

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label and noted the work hours.

Fixes #

@coveralls
Copy link

Pull Request Test Coverage Report for Build 8914321951

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 50.142%

Totals Coverage Status
Change from base Build 8578521436: 0.02%
Covered Lines: 1236
Relevant Lines: 2465

💛 - Coveralls

Copy link
Member

@enricobattocchi enricobattocchi left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @swissspidy!

@enricobattocchi enricobattocchi added this to the 4.6 milestone May 8, 2024
@enricobattocchi enricobattocchi merged commit 82c1d02 into Yoast:trunk May 8, 2024
22 checks passed
@swissspidy swissspidy deleted the patch-1 branch May 8, 2024 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants