-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Create default pages in store locale language #37795
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
Conversation
chihsuan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! @kshojib Tested well and looks good to me. 🚢
If you are interested, welcome to join our Slack channel for Woocommerce Contributor Day!
|
I think the error occurred because the global variable |
Yes, exactly—and this is really only a problem during test suite setup (because our bootstrap code runs before In the case of /**
* Switch WooCommerce to site language.
*
* @since 3.1.0
*/
function wc_switch_to_site_locale() {
global $wp_locale_switcher;
if ( function_exists( 'switch_to_locale' ) && isset( $wp_locale_switcher ) ) {
switch_to_locale( get_locale() );
// Filter on plugin_locale so load_plugin_textdomain loads the correct locale.
add_filter( 'plugin_locale', 'get_locale' );
// Init WC locale.
WC()->load_plugin_textdomain();
}
}We would also need to do effectively the same thing for |
|
Hey @chihsuan Thanks for addressing the error. @barryhughes I have added another commit with your suggestions. |
barryhughes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thank you for addressing that! Just waiting on our automated checks passing, and then we can go ahead and merge 👍
Submission Review Guidelines:
Changes proposed in this Pull Request:
Closes #34420 .
This PR fixes the store locale language issues when creating default pages.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
wp post list --post_type=page --fields=post_title,post_name