| @@ -27,15 +27,26 @@ | ||
| 27 | 27 | ); |
| 28 | 28 | wp_enqueue_script( |
| 29 | 29 | 'yatra-login-shortcode', |
| 30 | 30 | YATRA_PLUGIN_URL . 'assets/js/login-shortcode.js', |
| 31 | - ['jquery'], | |
| 31 | + ['jquery', 'wp-i18n'], | |
| 32 | 32 | YATRA_VERSION, |
| 33 | 33 | true |
| 34 | 34 | ); |
| 35 | + // Load JS translations so __() strings in login-shortcode.js are localized | |
| 36 | + // on this standalone account page (mirrors LoginShortcode::enqueueAssets). | |
| 37 | + if (function_exists('wp_set_script_translations')) { | |
| 38 | + wp_set_script_translations( | |
| 39 | + 'yatra-login-shortcode', | |
| 40 | + 'yatra', | |
| 41 | + YATRA_PLUGIN_PATH . 'i18n/languages' | |
| 42 | + ); | |
| 43 | + } | |
| 35 | 44 | wp_localize_script('yatra-login-shortcode', 'yatra_ajax', [ |
| 36 | 45 | 'ajax_url' => admin_url('admin-ajax.php'), |
| 37 | 46 | 'nonce' => wp_create_nonce('yatra_login_nonce'), |
| 47 | + 'rest_url' => esc_url_raw(rest_url('yatra/v1')), | |
| 48 | + 'rest_nonce' => wp_create_nonce('wp_rest'), | |
| 38 | 49 | 'debug' => defined('WP_DEBUG') && WP_DEBUG, |
| 39 | 50 | 'strings' => [ |
| 40 | 51 | 'login_error' => __('Login failed. Please try again.', 'yatra'), |
| 41 | 52 | 'network_error' => __('Network error. Please check your connection.', 'yatra'), |