Skip to content

Commit

Permalink
Make Gutenberg block strings translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiorino committed May 23, 2020
1 parent aa92911 commit 5e958fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions wordpress/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ public static function localization() {
'exit_without_saving' => __('All unsaved changes will be lost. Are you sure you want to leave this page?', 'crelly-slider'),
'switch_editor' => __('Switch editor', 'crelly-slider'),
'select_slider' => __('Select slider', 'crelly-slider'),
'no_sliders_found' => __('No sliders found. Do you want to&nbsp;<a href="admin.php?page=crellyslider&view=add">create one</a>?', 'crelly-slider'),
'no_sliders_selected' => __('No sliders selected. Edit this page and select a slider in the Crelly Slider editor block.', 'crelly-slider'),
);
wp_localize_script('crellyslider-admin', 'crellyslider_translations', $crellyslider_translations);
}
Expand Down
4 changes: 2 additions & 2 deletions wordpress/js/gutenberg.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ wp.blocks.registerBlockType('crelly-slider/slider', {
{
className: props.className + " cs-gutenberg",
dangerouslySetInnerHTML: {
__html: 'No sliders found. Do you want to&nbsp;<a href="admin.php?page=crellyslider&view=add">create one</a>?'
__html: crellyslider_translations.no_sliders_found
}
}
);
Expand Down Expand Up @@ -163,7 +163,7 @@ wp.blocks.registerBlockType('crelly-slider/slider', {
var attributes = props.attributes;
var alias = attributes.sliderAlias;
if(alias == null) {
return 'No sliders selected. Edit this page and select a slider in the Crelly Slider editor block.';
return crellyslider_translations.no_sliders_selected;
}
return '[crellyslider alias="' + alias + '"]';
},
Expand Down

0 comments on commit 5e958fe

Please sign in to comment.