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 #608

Merged
merged 2 commits into from
Apr 30, 2024
Merged

Rely on just-in-time translation loading #608

merged 2 commits into from
Apr 30, 2024

Conversation

swissspidy
Copy link
Member

What?

Removes the manual load_plugin_textdomain() call to rely on WordPress to load translations at the right time.

Bumps the requirement to WordPress 4.6 accordingly.

Also, defines the Requires * headers in the main plugin file so that WordPress can actually read them and prevent you from installing the plugin if requirements are not met.

The headers mustn't really be set in the readme.

Why?

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 :-)

How?

Testing Instructions

Switch to a different language and see that the translations are still loaded as expected.

Screenshots or screencast

Changelog Entry

Fixed - Ensured translations are only loaded just-in-time.

Copy link
Collaborator

@kasparsd kasparsd left a comment

Choose a reason for hiding this comment

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

This is great, thank you so much!

@kasparsd kasparsd merged commit 66faeef into WordPress:master Apr 30, 2024
1 check passed
@swissspidy swissspidy deleted the fix/load-textdomain branch April 30, 2024 14:53
@jeffpaul jeffpaul added this to the 0.10.0 milestone May 8, 2024
@kasparsd kasparsd mentioned this pull request Sep 18, 2024
@jeffpaul jeffpaul modified the milestones: 0.11.0, 0.10.0 Dec 2, 2024
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.

3 participants