PluginProbe
404 Solution / trunk
404 Solution vtrunk
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / data / script-translation-handles.php

script-translation-handles.php in 404 Solution trunk, at includes/data/script-translation-handles.php

36 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 exit;
4 }
5
6 /**
7 * Registered script handles whose JavaScript calls wp.i18n.__() and therefore
8 * needs a wp_set_script_translations() registration plus a per-locale JED JSON
9 * file in languages/.
10 *
11 * This is DATA, not logic. It is the single source of truth shared by three
12 * consumers, which is what keeps them from drifting apart:
13 *
14 * - ABJ_404_Solution_WPUtils::registerScriptTranslations() reads it at
15 * admin_enqueue_scripts time and registers every handle that the current
16 * screen actually enqueued (wp_set_script_translations() is a no-op for a
17 * handle that was never registered, so one call covers every screen).
18 * - scripts/build-script-translations.php reads it to know which JS file
19 * supplies the msgids for each handle's JSON files.
20 * - ScriptTranslationsTest asserts that every JS file under includes/ that
21 * contains a translation call appears here, so adding a new translated
22 * script without wiring it up fails the suite instead of silently shipping
23 * an English-only string.
24 *
25 * Keys are wp_enqueue_script() handles; values are the JS source path relative
26 * to the plugin root.
27 *
28 * @return array<string, string>
29 */
30 // allow-no-test-found: static data file (returns the handle-to-source map, no logic); the map is verified against the real on-disk JS sources in ScriptTranslationsTest.
31 return array(
32 'abj404-stats-confidence-chart' => 'includes/js/statsConfidenceChart.js',
33 'abj404-support-request-modal-view' => 'includes/js/support-request-modal-view.js',
34 'abj404-tools-migrate-plugin' => 'includes/js/toolsMigratePlugin.js',
35 );
36