Enqueue I18n strings
Some of our components require translation for non-English sites.
You can add the following code in function.php
file:
if ( ! function_exists( 'tweb_translate_components' ) ) :
function tweb_translate_components() {
wp_localize_script( 'wp-blocks', 'twebI18n', array(
'searchIcon' => _x( 'Search Icon', '@tigriweb/components', 'your-theme-name' ),
'removeIcon' => _x( 'Remove Icon', '@tigriweb/components', 'your-theme-name' ),
'removeImage' => _x( 'Remove Image', '@tigriweb/components', 'your-theme-name' ),
'removeMedia' => _x( 'Remove Media', '@tigriweb/components', 'your-theme-name' ),
'toggleMedia' => _x( 'Toggle Media', '@tigriweb/components', 'your-theme-name' ),
'editLink' => _x( 'Edit Link', '@tigriweb/components', 'your-theme-name' ),
'openMediaLibrary' => _x( 'Open Media Library', '@tigriweb/components', 'your-theme-name' ),
'heading' => _x( 'Heading', '@tigriweb/components', 'your-theme-name' ),
// translators: %s is replaced with the heading tag | H1-H6
'headingTag' => _x( 'Heading %s', '@tigriweb/components', 'your-theme-name' ),
) );
}
endif;
add_action( 'enqueue_block_editor_assets', 'tweb_translate_components' );
Last updated