-
Notifications
You must be signed in to change notification settings - Fork 71
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
issue-1208: Improve i18n support for WordPress 6.7 #1209
base: develop
Are you sure you want to change the base?
issue-1208: Improve i18n support for WordPress 6.7 #1209
Conversation
/** | ||
* Load plugin textdomain. | ||
* | ||
* @since 0.9.0 | ||
*/ | ||
function apple_news_load_textdomain() { | ||
load_plugin_textdomain( 'apple-news', false, __DIR__ . '/lang' ); | ||
} | ||
add_action( 'plugins_loaded', 'apple_news_load_textdomain' ); | ||
|
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.
Since WordPress 4.7, this is no longer required for plugins hosted in WordPress.org.
The translation comes automatically from here: https://translate.wordpress.org/projects/wp-plugins/publish-to-apple-news/
*/ | ||
function apple_news_get_plugin_data() { | ||
function apple_news_get_plugin_data( $translate = true ) { |
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.
Allow this function to be used before init
, where translation is not supported or necessary. See the related changed unit test as part of this pr.
add_action( | ||
'plugins_loaded', | ||
[ $this, 'action_plugins_loaded' ] | ||
'init', |
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.
I learned as part of this fix that loading __(
translations before init
has always been incorrect from plugin developers. The difference now is that WordPress is making that obvious to developers like me as part of WordPress 6.7 and encouraging us to hook translation code in the proper hook.
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.
👍
fixes #1208