| @@ -439,8 +439,20 @@ | ||
| 439 | 439 | $jsVersion, |
| 440 | 440 | true |
| 441 | 441 | ); |
| 442 | 442 | |
| 443 | + // The bundle calls the global wp.i18n.__() (it never ships its | |
| 444 | + // own copy), and scripts/extract-js-pot.mjs writes every admin | |
| 445 | + // string's `#:` reference as this bundle's path precisely so | |
| 446 | + // WordPress's md5(handle src) JSON lookup matches. This call is | |
| 447 | + // the missing last link: it tells WordPress to load | |
| 448 | + // i18n/languages/yatra-{locale}-{md5}.json (or the copy under | |
| 449 | + // WP_LANG_DIR/plugins) for the admin UI. Without it, translated | |
| 450 | + // admin strings never reach the SPA. Mirrors FrontendAssetsProvider. | |
| 451 | + if (function_exists('wp_set_script_translations')) { | |
| 452 | + wp_set_script_translations('yatra-admin', 'yatra', YATRA_PLUGIN_PATH . 'i18n/languages'); | |
| 453 | + } | |
| 454 | + | |
| 443 | 455 | // Localize script data |
| 444 | 456 | wp_localize_script('yatra-admin', 'yatraAdmin', $localized_data); |
| 445 | 457 | |
| 446 | 458 | // Phone dataset for admin displays (flag + dial-code detection of |