Skip to content
Snippets Groups Projects
Verified Commit 11578df9 authored by Bartek Jaskulski's avatar Bartek Jaskulski
Browse files

feat: add translations loading compatible with WP 6.7

parent 98c60269
No related branches found
No related tags found
1 merge request!11feat: add translations loading compatible with WP 6.7
Pipeline #442100 passed
## [2.0.0] - 2024-11-18
### Changed
- WordPress 6.7 compatibility: loading text domain
## [1.2.3] - 2024-11-09 ## [1.2.3] - 2024-11-09
### Fixed ### Fixed
- Hide doing it wrong notice on production environment - Hide doing it wrong notice on production environment
......
...@@ -153,18 +153,13 @@ final class PluginBootstrap { ...@@ -153,18 +153,13 @@ final class PluginBootstrap {
if ( method_exists( $plugin_info, 'get_language_dir' ) ) { if ( method_exists( $plugin_info, 'get_language_dir' ) ) {
$lang_dir = $plugin_info->get_language_dir(); $lang_dir = $plugin_info->get_language_dir();
} }
$text_domain = $plugin_info->get_text_domain(); add_action( 'init', function () use ( $plugin_info, $lang_dir ) {
add_filter( 'doing_it_wrong_trigger_error', function( $doing_it_wrong, $function, $message, $version ) use ( $text_domain ) {
if ( wp_get_environment_type() === 'production' && $function === '_load_textdomain_just_in_time' && strpos( $message, '<code>' . $text_domain . '</code>' ) !== false ) {
return false;
}
return $doing_it_wrong;
}, 10, 4 );
\load_plugin_textdomain( \load_plugin_textdomain(
$plugin_info->get_text_domain(), $plugin_info->get_text_domain(),
false, '',
basename( $plugin_info->get_plugin_dir() ) . "/$lang_dir/" basename( $plugin_info->get_plugin_dir() ) . "/$lang_dir/"
); );
});
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment