diff --git a/blockbase/block-templates/404.html b/blockbase/block-templates/404.html index 2471b1d99c..55a8d80a7e 100644 --- a/blockbase/block-templates/404.html +++ b/blockbase/block-templates/404.html @@ -4,11 +4,15 @@
-

Oops! That page can’t be found.

+

+ +

-

It looks like nothing was found at this location. Maybe try a search?

+

+ +

diff --git a/blockbase/block-templates/search.html b/blockbase/block-templates/search.html index e7166322ca..6ede35123f 100644 --- a/blockbase/block-templates/search.html +++ b/blockbase/block-templates/search.html @@ -4,7 +4,7 @@
-

Results:

+

:

diff --git a/blockbase/functions.php b/blockbase/functions.php index 476b2a02e7..0fbee25664 100644 --- a/blockbase/functions.php +++ b/blockbase/functions.php @@ -96,7 +96,12 @@ function blockbase_fonts_url() { } /** - * Customize Global Styles + * Customize Global Styles. */ -require get_template_directory() . '/inc/wp-customize-colors.php'; -require get_template_directory() . '/inc/wp-customize-color-palettes.php'; +require_once get_template_directory() . '/inc/wp-customize-colors.php'; +require_once get_template_directory() . '/inc/wp-customize-color-palettes.php'; + +/** + * Load a block for i18n. + */ +require_once get_template_directory() . '/i18n-strings-block/index.php'; diff --git a/blockbase/i18n-strings-block/block.json b/blockbase/i18n-strings-block/block.json new file mode 100644 index 0000000000..8b55fd105f --- /dev/null +++ b/blockbase/i18n-strings-block/block.json @@ -0,0 +1,17 @@ +{ + "apiVersion": 2, + "name": "blockbase/i18n-strings", + "title": "I18N Strings", + "category": "text", + "icon": "smiley", + "description": "Pass strings to PHP for i18n.", + "supports": { + "html": false + }, + "textdomain": "blockbase", + "attributes": { + "string": { + "type": "string" + } + } +} diff --git a/blockbase/i18n-strings-block/index.php b/blockbase/i18n-strings-block/index.php new file mode 100644 index 0000000000..bab69272c5 --- /dev/null +++ b/blockbase/i18n-strings-block/index.php @@ -0,0 +1,27 @@ + 'render_block_i18n_strings', + ) + ); +} + +function render_block_i18n_strings( $attributes ) { + if ( I18N_STRINGS && ! empty ( I18N_STRINGS[ $attributes['string'] ] ) ) { + return I18N_STRINGS[ $attributes['string'] ]; + }; + + return $attributes['string']; +} + +add_action( 'init', 'create_block_i18n_strings_block_init' ); diff --git a/blockbase/i18n-strings.php b/blockbase/i18n-strings.php new file mode 100644 index 0000000000..5377b90a6c --- /dev/null +++ b/blockbase/i18n-strings.php @@ -0,0 +1,7 @@ + __( 'Results', 'blockbase' ), + 'Oops! That page can’t be found.' => __( 'Oops! That page can’t be found.', 'blockbase' ), + 'It looks like nothing was found at this location. Maybe try a search?' => __( 'It looks like nothing was found at this location. Maybe try a search?', 'blockbase' ), +) );