This commit is contained in:
Mykyta Synelnikov
2024-11-13 16:42:26 +02:00
parent 2679f4744b
commit 48371d1d06
3 changed files with 48 additions and 41 deletions
+29 -29
View File
@@ -204,8 +204,8 @@ if ( ! class_exists( 'UM' ) ) {
$this->is_filtering = 0;
$this->honeypot = 'um_request';
// textdomain loading
add_action( 'init', array( &$this, 'localize' ), 0 );
// @todo investigate permanently delete https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/#Enhanced-support-for-only-using-PHP-translation-files
add_action( 'init', array( &$this, 'localize' ), 0 ); // textdomain loading
// include UM classes
$this->includes();
@@ -243,33 +243,33 @@ if ( ! class_exists( 'UM' ) ) {
*
* @since 2.8.5 WordPress native functions are used to make this function clear.
*/
public function localize() {
$default_domain = dirname( plugin_basename( UM_PLUGIN ) );
/**
* Filters the plugin's textdomain.
*
* @param {string} $domain Plugin's textdomain.
*
* @return {string} Maybe changed plugin's textdomain.
*
* @since 1.3.x
* @hook um_language_textdomain
*
* @example <caption>Change UM language locale.</caption>
* function my_um_language_textdomain( $domain ) {
* $domain = 'ultimate-member-custom';
* return $domain;
* }
* add_filter( 'um_language_textdomain', 'my_um_language_textdomain' );
*/
$domain = apply_filters( 'um_language_textdomain', $default_domain );
// Unload textdomain if it has already loaded.
if ( is_textdomain_loaded( $domain ) ) {
unload_textdomain( $domain, true );
}
load_plugin_textdomain( $domain, false, $default_domain . '/languages' );
}
// public function localize() {
// $default_domain = dirname( plugin_basename( UM_PLUGIN ) );
// /**
// * Filters the plugin's textdomain.
// *
// * @param {string} $domain Plugin's textdomain.
// *
// * @return {string} Maybe changed plugin's textdomain.
// *
// * @since 1.3.x
// * @hook um_language_textdomain
// *
// * @example <caption>Change UM language locale.</caption>
// * function my_um_language_textdomain( $domain ) {
// * $domain = 'ultimate-member-custom';
// * return $domain;
// * }
// * add_filter( 'um_language_textdomain', 'my_um_language_textdomain' );
// */
// $domain = apply_filters( 'um_language_textdomain', $default_domain );
//
// // Unload textdomain if it has already loaded.
// if ( is_textdomain_loaded( $domain ) ) {
// unload_textdomain( $domain, true );
// }
// load_plugin_textdomain( $domain, false, $default_domain . '/languages' );
// }
/**
* 1.3.x active extensions deactivate for properly running 2.0.x AJAX upgrades