Skip to content

Commit

Permalink
Merge pull request #28 from vektor-inc/fix/translate
Browse files Browse the repository at this point in the history
Fix translate
  • Loading branch information
shimotmk authored Jun 27, 2023
2 parents bd009ac + 7df2be1 commit 4d0b47f
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions inc/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
add_action(
'init',
function () {
load_plugin_textdomain( 'vk-simple-copy-block' );
$blocks = array(
'simple-copy',
'copy-target',
Expand All @@ -22,6 +23,10 @@ function () {
register_block_type(
VK_SIMPLE_COPY_BLOCK_DIR_PATH . 'build/' . $block . '/'
);
wp_set_script_translations(
'vk-simple-copy-block-'. $block . '-editor-script-js',
'vk-simple-copy-block'
);
}
}
);
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ e.g.

== Changelog ==

[ Fix ] Translation

= 0.1.1 =
[ Specification change ] Sentences and lower case tuning
[ Specification change ] Add plugins banner
Expand Down
1 change: 1 addition & 0 deletions src/copy-button-wrap/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "vk-simple-copy-block/copy-button-wrap",
"category": "vk-blocks-cat",
"title": "Copy Button",
"textdomain": "vk-simple-copy-block",
"parent": ["vk-simple-copy-block/simple-copy"],
"attributes": {
"buttonAlign": {
Expand Down
2 changes: 2 additions & 0 deletions src/copy-button-wrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* WordPress dependencies
*/
import { registerBlockType } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -20,6 +21,7 @@ if (
pathString.indexOf('widgets.php') === -1
) {
registerBlockType(name, {
title: __( 'Copy Button', 'vk-simple-copy-block' ),
icon: <CopyIcon />,
...settings,
save,
Expand Down
1 change: 1 addition & 0 deletions src/copy-button/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"category": "vk-blocks-cat",
"title": "Copy Button",
"description": "Button to copy the code of the copy target block.",
"textdomain": "vk-simple-copy-block",
"parent": ["vk-simple-copy-block/copy-button-wrap"],
"attributes": {
"text": {
Expand Down
3 changes: 3 additions & 0 deletions src/copy-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* WordPress dependencies
*/
import { registerBlockType } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -20,6 +21,8 @@ if (
pathString.indexOf('widgets.php') === -1
) {
registerBlockType(name, {
title: __( 'Copy Button', 'vk-simple-copy-block' ),
description: __( 'Button to copy the code of the copy target block.', 'vk-simple-copy-block' ),
icon: <CopyIcon />,
...settings,
save,
Expand Down
1 change: 1 addition & 0 deletions src/copy-target/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"category": "vk-blocks-cat",
"title": "Copy Target",
"description": "The inner blocks of this block will be copied.",
"textdomain": "vk-simple-copy-block",
"parent": [
"vk-simple-copy-block/simple-copy"
],
Expand Down
3 changes: 3 additions & 0 deletions src/copy-target/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* WordPress dependencies
*/
import { registerBlockType } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -20,6 +21,8 @@ if (
pathString.indexOf('widgets.php') === -1
) {
registerBlockType(name, {
title: __( 'Copy Target', 'vk-simple-copy-block' ),
description: __( 'The inner blocks of this block will be copied.', 'vk-simple-copy-block' ),
icon: <CopyIcon />,
...settings,
save,
Expand Down
1 change: 1 addition & 0 deletions src/simple-copy/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"category": "vk-blocks-cat",
"title": "Simple Copy",
"description": "A block to copy the code of the block inside the copy target.",
"textdomain": "vk-simple-copy-block",
"attributes": {
"blockId": {
"type": "string"
Expand Down
3 changes: 3 additions & 0 deletions src/simple-copy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* WordPress dependencies
*/
import { registerBlockType } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -21,6 +22,8 @@ if (
pathString.indexOf('widgets.php') === -1
) {
registerBlockType(name, {
title: __( 'Simple Copy', 'vk-simple-copy-block' ),
description: __( 'A block to copy the code of the block inside the copy target.', 'vk-simple-copy-block' ),
icon: <CopyIcon />,
...settings,
save,
Expand Down

0 comments on commit 4d0b47f

Please sign in to comment.