Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit c064279

Browse files
committed
Implement localisation fix for WPv5
1 parent eea2b34 commit c064279

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

includes/scripts-and-styles.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ function benenson_gutenberg_assets() {
105105
'wp-data',
106106
], true, false );
107107

108-
wp_add_inline_script(
109-
'benenson-blocks-js',
110-
sprintf( "wp.i18n.setLocaleData(%s, 'benenson')", wp_json_encode( gutenberg_get_jed_locale_data( 'benenson' ) ) ),
111-
'before'
112-
);
108+
if ( function_exists( 'gutenberg_get_jed_locale_data' ) ) {
109+
wp_add_inline_script(
110+
'benenson-blocks-js',
111+
sprintf( "wp.i18n.setLocaleData(%s, 'benenson')", wp_json_encode( gutenberg_get_jed_locale_data( 'benenson' ) ) ),
112+
'before'
113+
);
114+
} elseif ( function_exists( 'wp_set_script_translations' ) ) {
115+
wp_set_script_translations( 'benenson-blocks-js', 'benenson' );
116+
}
113117

114118
wp_enqueue_style( 'benenson-gutenberg', benenson_asset_uri( 'styles' ) . '/gutenberg.css', [ 'wp-block-library-theme' ], '1', 'all' );
115119
}

0 commit comments

Comments
 (0)