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 localised WordCamp logs #1431

Open
wants to merge 2 commits into
base: production
Choose a base branch
from
Open

Fix localised WordCamp logs #1431

wants to merge 2 commits into from

Conversation

dd32
Copy link
Member

@dd32 dd32 commented Nov 25, 2024

The current WordCamp status code filters locale which is the incorrect way to switch locales, causing logs to contain localised post_status labels, causing the logs to contain a localised status which is unmatchable and causes PHP Notices and broken UIs.

Fixes #1300 probably

There's numerous other uses of set_locale_to_en_us in the codebase, which likely do not work. The locale can't be changed at runtime simply by changing the value of the filter, the filter only changes which locale is initially loaded.

Comment on lines 18 to +20
add_action( 'init', array( $this, 'register_post_types' ) );
add_action( 'init', array( $this, 'register_post_statuses' ) );
add_action( 'change_locale', array( $this, 'register_post_statuses' ) ); // Re-register them when the locale changes, to have localised statuses.
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
add_action( 'init', array( $this, 'register_post_types' ) );
add_action( 'init', array( $this, 'register_post_statuses' ) );
add_action( 'change_locale', array( $this, 'register_post_statuses' ) ); // Re-register them when the locale changes, to have localised statuses.
add_action( 'init', array( $this, 'register_post_types' ) );
add_action( 'init', array( $this, 'register_post_statuses' ) );
// Re-register them when the locale changes, to have localised statuses.
add_action( 'change_locale', array( $this, 'register_post_types' ) );
add_action( 'change_locale', array( $this, 'register_post_statuses' ) );

The post types can probably be reloaded too, to ensure they're properly translated, but I don't think they're used anywhere in logs so are likely less problematic.

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.

Don't translate wordcamp statuses in logs
1 participant