Missing Script Translation for Wizard Script

#1036602
  • Resolved Daniel
    Rank Math free

    The rank-math-wizard script is missing proper internationalization support due to a missing wp_set_script_translation() call after script enqueuing.

    Issue Description
    The wizard.js script is enqueued without setting up script translations, which prevents the script from accessing translated strings in non-English WordPress installations.

    Current Code Location
    The issue is located where the wizard script is enqueued:

    wp_enqueue_script( 'rank-math-wizard', rank_math()->plugin_url() . 'assets/admin/js/wizard.js', [ 'media-editor', 'select2-rm', 'lodash', 'rank-math-common', 'rank-math-components' ], rank_math()->version, true );
    Expected Fix
    Add the following line immediately after the wp_enqueue_script() call:

    wp_set_script_translation( 'rank-math-wizard', 'rank-math' );
    Complete Fixed Code

    wp_enqueue_script( 'rank-math-wizard', rank_math()->plugin_url() . 'assets/admin/js/wizard.js', [ 'media-editor', 'select2-rm', 'lodash', 'rank-math-common', 'rank-math-components' ], rank_math()->version, true );
    wp_set_script_translation( 'rank-math-wizard', 'rank-math' );

    Impact
    Non-English users see untranslated strings in the wizard interface
    Breaks the internationalization experience for multilingual sites
    Inconsistent with WordPress best practices for script localization

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    We apologize for the issue you are facing with the missing script translation for the Rank Math wizard. It seems that the wp_set_script_translation() function is indeed necessary to ensure that the wizard script can access translated strings in non-English WordPress installations.

    To resolve this issue, you can modify the code where the rank-math-wizard script is enqueued by adding the wp_set_script_translation() call immediately after it. Here’s how the complete fixed code should look:

    wp_enqueue_script( 'rank-math-wizard', rank_math()->plugin_url() . 'assets/admin/js/wizard.js', [ 'media-editor', 'select2-rm', 'lodash', 'rank-math-common', 'rank-math-components' ], rank_math()->version, true );
    wp_set_script_translation( 'rank-math-wizard', 'rank-math' );

    This change will ensure that non-English users will see the translated strings in the wizard interface, improving the internationalization experience for multilingual sites and aligning with WordPress best practices for script localization.

    Thank you for bringing this concern to our attention! If you have any further questions or need additional assistance, please feel free to reply to this ticket.

    Sources:
    Multilingual SEO with Rank Math SEO & WPML » Rank Math

    Hello,

    We have logged this issue and the permanent fix will be included in an upcoming release.

    We apologize for any inconveniences that might have been caused as a result of this issue.

    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

The ticket ‘Missing Script Translation for Wizard Script’ is closed to new replies.