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

Fix | Refactor class-config to ensure compatibility with translations on WP6.7 #430

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

g-dom3
Copy link
Collaborator

@g-dom3 g-dom3 commented Nov 20, 2024

This PR updates the Complianz plugin to comply with WordPress 6.7’s stricter requirements for translation loading, addressing a "Doing It Wrong" error caused by premature loading of translated strings. The load_plugin_textdomain() function was moved to a dedicated method called at the appropriate lifecycle stage, ensuring proper functionality, and its premature invocation in the hooks() method was removed.

A new load_translated() method centralizes the loading of translation dependencies and executes on the init hook with priority 0 for early initialization.
Modularization was improved with methods for handling common translations, dynamically adding Brazil-specific options, and loading configuration files based on user preferences and regions. Action priorities were adjusted for consistency, ensuring proper sequencing of load_translated(), init(), and load_pages().

@g-dom3 g-dom3 changed the title Fix | Refactor class-config to ensure compatibility with translations on WP… Fix | Refactor class-config to ensure compatibility with translations on WP6.7 Nov 20, 2024
Copy link

@theperu theperu left a comment

Choose a reason for hiding this comment

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

LGTM! 👍🏻

Tests Performed

  1. Checked that the banner is being displayed and that it updates after changing the language.
    Example using Italian:
Screenshot 2024-11-21 at 13 11 13
  1. Checked that the docs are correctly linked and update when a user changes the language.
    Example using Italian:
Screenshot 2024-11-21 at 13 10 43

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.

2 participants