diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 112fa94d..36308157 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -53,6 +53,9 @@ if ( ! class_exists( 'Admin_Settings' ) ) { add_action( 'admin_notices', array( $this, 'check_wrong_licenses' ) ); add_action( 'admin_init', array( &$this, 'um_download_install_info' ) ); + + // wpml translations + add_filter( 'um_admin_settings_email_section_fields', array( &$this, 'um_admin_settings_email_section_fields' ), 10, 2 ); } @@ -1440,7 +1443,7 @@ if ( ! class_exists( 'Admin_Settings' ) ) { $in_theme = UM()->mail()->template_in_theme( $email_key ); - $section_fields = array( + $section_fields = apply_filters( 'um_admin_settings_email_section_fields', array( array( 'id' => 'um_email_template', 'type' => 'hidden', @@ -1468,7 +1471,7 @@ if ( ! class_exists( 'Admin_Settings' ) ) { 'value' => UM()->mail()->get_email_template( $email_key ), 'in_theme' => $in_theme ), - ); + ), $email_key ); return $this->render_settings_section( $section_fields, 'email', $email_key ); } @@ -2170,5 +2173,37 @@ Use Only Cookies: get_locale_from_language_code( $sitepress->get_default_language() ); + $current_language_code = $sitepress->get_locale_from_language_code( $sitepress->get_current_language() ); + + $lang = ''; + + if ( $default_language_code != $current_language_code ) { + $lang = '_' . $current_language_code; + } + + $value_default = UM()->options()->get( $email_key . '_sub' ); + $value = UM()->options()->get( $email_key . '_sub' . $lang ); + + $section_fields[2]['id'] = $email_key . '_sub' . $lang; + $section_fields[2]['value'] = ! empty( $value ) ? $value : $value_default; + } + + return $section_fields; + } } } \ No newline at end of file