Skip to content

Commit 9539ba5

Browse files
committed
Clean up loading of translations
1 parent 4812427 commit 9539ba5

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

includes/Services/I18nService.php

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,31 @@ public function load_text_domain() {
4242
* Enqueue script for translations of the performance panel settings
4343
*/
4444
public function prepare_and_load_js_translations() {
45-
wp_register_script(
46-
'wp-module-performance-translations',
47-
NFD_PERFORMANCE_BUILD_URL . '/translations.min.js',
48-
array( 'lodash', 'react', 'react-dom', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-html-entities', 'wp-i18n' ),
49-
$this->version,
50-
true
51-
);
5245

53-
$this::load_js_translations(
54-
'wp-module-performance',
55-
'wp-module-performance-translations',
56-
NFD_PERFORMANCE_PLUGIN_LANGUAGES_DIR
46+
add_action(
47+
'admin_enqueue_scripts',
48+
function() {
49+
$this::load_js_translations(
50+
'wp-module-performance',
51+
'nfd-performance',
52+
NFD_PERFORMANCE_PLUGIN_LANGUAGES_DIR
53+
);
54+
55+
$this::load_js_translations(
56+
'wp-module-performance',
57+
'nfd-performance-bulk-optimizer',
58+
NFD_PERFORMANCE_PLUGIN_LANGUAGES_DIR
59+
);
60+
61+
$this::load_js_translations(
62+
'wp-module-performance',
63+
'nfd-performance-image-bulk-optimizer',
64+
NFD_PERFORMANCE_PLUGIN_LANGUAGES_DIR
65+
);
66+
},
67+
100
5768
);
5869

59-
wp_enqueue_script( 'wp-module-performance-translations' );
6070
}
6171

6272
/**

0 commit comments

Comments
 (0)