Skip to content

Commit 89a25ea

Browse files
committed
Script Modules: Flatten translation override fields onto registered entry.
1 parent 374a234 commit 89a25ea

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/wp-includes/class-wp-script-modules.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
* dependencies: array<int, array{ id: string, import: 'static'|'dynamic' }>,
2020
* in_footer: bool,
2121
* fetchpriority: 'auto'|'low'|'high',
22-
* translations?: array{ textdomain: string, path: string },
22+
* textdomain?: string,
23+
* translations_path?: string,
2324
* }
2425
*/
2526
class WP_Script_Modules {
@@ -359,10 +360,8 @@ public function set_translations( string $id, string $domain = 'default', string
359360
return false;
360361
}
361362

362-
$this->registered[ $id ]['translations'] = array(
363-
'textdomain' => $domain,
364-
'path' => $path,
365-
);
363+
$this->registered[ $id ]['textdomain'] = $domain;
364+
$this->registered[ $id ]['translations_path'] = $path;
366365

367366
return true;
368367
}
@@ -394,8 +393,8 @@ public function print_script_module_translations(): void {
394393
JS;
395394

396395
foreach ( $module_ids as $id ) {
397-
$domain = $this->registered[ $id ]['translations']['textdomain'] ?? 'default';
398-
$path = $this->registered[ $id ]['translations']['path'] ?? '';
396+
$domain = $this->registered[ $id ]['textdomain'] ?? 'default';
397+
$path = $this->registered[ $id ]['translations_path'] ?? '';
399398

400399
$json_translations = load_script_module_textdomain( $id, $domain, $path );
401400

0 commit comments

Comments
 (0)