Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow using a custom domainpath for viewscripts
Browse files Browse the repository at this point in the history
aristath committed Apr 7, 2022
1 parent 59337a0 commit 6333db8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/blocks.php
Original file line number Diff line number Diff line change
@@ -616,8 +616,9 @@ function wp_enqueue_block_view_script( $block_name, $args ) {
'ver' => false,
'in_footer' => false,

// Additional arg to allow translations for the script's textdomain.
// Additional args to allow translations for the script's textdomain.
'textdomain' => '',
'domainpath' => null,
)
);

@@ -646,7 +647,7 @@ function wp_enqueue_block_view_script( $block_name, $args ) {

// If a textdomain is defined, use it to set the script translations.
if ( ! empty( $args['textdomain'] ) && in_array( 'wp-i18n', $args['deps'], true ) ) {
wp_set_script_translations( $args['handle'], $args['textdomain'] );
wp_set_script_translations( $args['handle'], $args['textdomain'], $args['domainpath'] );
}

return $content;

0 comments on commit 6333db8

Please sign in to comment.