How to translate registration custom message?

[ad_1]

Thread Starter
sao987

(@sao987)

After some testings, I realised that I can’t use ” ‘ ” in this php code to replace %s part. That ‘ resulted in error message.

So I asked ChatGPT to rewrite this code for WPML, and it works perfectly. I will leave it here if anyone would need it.

<?php
/**
 * Template for the message after registration process
 *
 * This template can be overridden by copying it to yourtheme/ultimate-member/templates/message.php
 *
 * Call: function parse_shortcode_args()
 *
 * @version 2.6.1
 *
 * @var string $mode
 * @var int    $form_id
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
} 

// Determine the current language
$current_language = apply_filters( 'wpml_current_language', null );

?>

<div class="um <?php echo esc_attr( $this->get_class( $mode ) ); ?> um-<?php echo esc_attr( $form_id ); ?>">

	<div class="um-postmessage">

        <?php
        if ( $current_language === 'ja' ) {
            // Japanese message
            printf( __( '登録いただきありがとうございます。', 'ultimate-member' ), $this->custom_message );
        } else {
            // English message
            printf( __( 'Thank you for registering.', 'ultimate-member' ), $this->custom_message );
        }
        ?>

	</div>

</div>

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer