Skip to content

Commit

Permalink
Block Library: Move translatable fields to block.json files
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Apr 23, 2021
1 parent 79a9628 commit 1fa873a
Show file tree
Hide file tree
Showing 38 changed files with 88 additions and 117 deletions.
3 changes: 3 additions & 0 deletions packages/block-library/src/archives/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"apiVersion": 2,
"name": "core/archives",
"title": "Archives",
"category": "widgets",
"description": "Display a monthly archive of your posts.",
"textdomain": "default",
"attributes": {
"displayAsDropdown": {
"type": "boolean",
Expand Down
3 changes: 0 additions & 3 deletions packages/block-library/src/archives/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* WordPress dependencies
*/
import { archive as icon } from '@wordpress/icons';
import { __, _x } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -15,8 +14,6 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Archives', 'block title' ),
description: __( 'Display a monthly archive of your posts.' ),
icon,
example: {},
edit,
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/audio/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"apiVersion": 2,
"name": "core/audio",
"title": "Audio",
"category": "media",
"description": "Embed a simple audio player.",
"keywords": [ "music", "sound", "podcast", "recording" ],
"textdomain": "default",
"attributes": {
"src": {
"type": "string",
Expand Down
9 changes: 0 additions & 9 deletions packages/block-library/src/audio/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { audio as icon } from '@wordpress/icons';

/**
Expand All @@ -18,14 +17,6 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Audio', 'block title' ),
description: __( 'Embed a simple audio player.' ),
keywords: [
__( 'music' ),
__( 'sound' ),
__( 'podcast' ),
__( 'recording' ),
],
icon,
transforms,
deprecated,
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/block/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"apiVersion": 2,
"name": "core/block",
"title": "Reusable block",
"category": "reusable",
"description": "Create and save content to reuse across your site. Update the block, and the changes apply everywhere it’s used.",
"textdomain": "default",
"attributes": {
"ref": {
"type": "number"
Expand Down
9 changes: 0 additions & 9 deletions packages/block-library/src/block/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';

/**
* Internal dependencies
*/
Expand All @@ -14,9 +9,5 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Reusable block', 'block title' ),
description: __(
'Create and save content to reuse across your site. Update the block, and the changes apply everywhere it’s used.'
),
edit,
};
8 changes: 8 additions & 0 deletions packages/block-library/src/button/block.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"apiVersion": 2,
"name": "core/button",
"title": "Button",
"category": "design",
"parent": [ "core/buttons" ],
"description": "Prompt visitors to take action with a button-style link.",
"keywords": [ "link" ],
"textdomain": "default",
"attributes": {
"url": {
"type": "string",
Expand Down Expand Up @@ -66,6 +70,10 @@
"__experimentalFontFamily": true,
"__experimentalSelector": ".wp-block-button__link"
},
"styles": [
{ "name": "fill", "label": "Fill", "isDefault": true },
{ "name": "outline", "label": "Outline" }
],
"editorStyle": "wp-block-button-editor",
"style": "wp-block-button"
}
11 changes: 1 addition & 10 deletions packages/block-library/src/button/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import { button as icon } from '@wordpress/icons';

/**
Expand All @@ -17,23 +17,14 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Button', 'block title' ),
description: __(
'Prompt visitors to take action with a button-style link.'
),
icon,
keywords: [ __( 'link' ) ],
example: {
attributes: {
className: 'is-style-fill',
backgroundColor: 'vivid-green-cyan',
text: __( 'Call to Action' ),
},
},
styles: [
{ name: 'fill', label: __( 'Fill' ), isDefault: true },
{ name: 'outline', label: __( 'Outline' ) },
],
edit,
save,
deprecated,
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/buttons/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"apiVersion": 2,
"name": "core/buttons",
"title": "Buttons",
"category": "design",
"description": "Prompt visitors to take action with a group of button-style links.",
"keywords": [ "link" ],
"textdomain": "default",
"attributes": {
"contentJustification": {
"type": "string"
Expand Down
7 changes: 1 addition & 6 deletions packages/block-library/src/buttons/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import { buttons as icon } from '@wordpress/icons';

/**
Expand All @@ -19,12 +19,7 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Buttons', 'block title' ),
description: __(
'Prompt visitors to take action with a group of button-style links.'
),
icon,
keywords: [ __( 'link' ) ],
example: {
innerBlocks: [
{
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/calendar/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"apiVersion": 2,
"name": "core/calendar",
"title": "Calendar",
"category": "widgets",
"description": "A calendar of your site’s posts.",
"keywords": [ "posts", "archive" ],
"textdomain": "default",
"attributes": {
"month": {
"type": "integer"
Expand Down
4 changes: 0 additions & 4 deletions packages/block-library/src/calendar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* WordPress dependencies
*/
import { calendar as icon } from '@wordpress/icons';
import { __, _x } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -15,10 +14,7 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Calendar', 'block title' ),
description: __( 'A calendar of your site’s posts.' ),
icon,
keywords: [ __( 'posts' ), __( 'archive' ) ],
example: {},
edit,
};
3 changes: 3 additions & 0 deletions packages/block-library/src/categories/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"apiVersion": 2,
"name": "core/categories",
"title": "Categories",
"category": "widgets",
"description": "Display a list of all categories.",
"textdomain": "default",
"attributes": {
"displayAsDropdown": {
"type": "boolean",
Expand Down
3 changes: 0 additions & 3 deletions packages/block-library/src/categories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* WordPress dependencies
*/
import { category as icon } from '@wordpress/icons';
import { __, _x } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -15,8 +14,6 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Categories', 'block title' ),
description: __( 'Display a list of all categories.' ),
icon,
example: {},
edit,
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/code/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"apiVersion": 2,
"name": "core/code",
"title": "Code",
"category": "text",
"description": "Display code snippets that respect your spacing and tabs.",
"textdomain": "default",
"attributes": {
"content": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions packages/block-library/src/code/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import { code as icon } from '@wordpress/icons';

/**
Expand All @@ -17,10 +17,6 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Code', 'block title' ),
description: __(
'Display code snippets that respect your spacing and tabs.'
),
icon,
example: {
attributes: {
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/column/block.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"apiVersion": 2,
"name": "core/column",
"title": "Column",
"category": "text",
"parent": [ "core/columns" ],
"description": "A single column within a columns block.",
"textdomain": "default",
"attributes": {
"verticalAlignment": {
"type": "string"
Expand Down
3 changes: 0 additions & 3 deletions packages/block-library/src/column/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { column as icon } from '@wordpress/icons';

/**
Expand All @@ -17,9 +16,7 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Column', 'block title' ),
icon,
description: __( 'A single column within a columns block.' ),
edit,
save,
deprecated,
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/columns/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"apiVersion": 2,
"name": "core/columns",
"title": "Columns",
"category": "design",
"description": "Add a block that displays content in multiple columns, then add whatever content blocks you’d like.",
"textdomain": "default",
"attributes": {
"verticalAlignment": {
"type": "string"
Expand Down
6 changes: 1 addition & 5 deletions packages/block-library/src/columns/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import { columns as icon } from '@wordpress/icons';

/**
Expand All @@ -19,11 +19,7 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Columns', 'block title' ),
icon,
description: __(
'Add a block that displays content in multiple columns, then add whatever content blocks you’d like.'
),
variations,
example: {
innerBlocks: [
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/cover/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"apiVersion": 2,
"name": "core/cover",
"title": "Cover",
"category": "media",
"description": "Add an image or video with a text overlay — great for headers.",
"textdomain": "default",
"attributes": {
"url": {
"type": "string"
Expand Down
6 changes: 1 addition & 5 deletions packages/block-library/src/cover/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import { cover as icon } from '@wordpress/icons';

/**
Expand All @@ -18,10 +18,6 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Cover', 'block title' ),
description: __(
'Add an image or video with a text overlay — great for headers.'
),
icon,
example: {
attributes: {
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/embed/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"apiVersion": 2,
"name": "core/embed",
"title": "Embed",
"category": "embed",
"description": "Add a block that displays content pulled from other sites, like Twitter, Instagram or YouTube.",
"textdomain": "default",
"attributes": {
"url": {
"type": "string"
Expand Down
9 changes: 0 additions & 9 deletions packages/block-library/src/embed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,10 @@ import variations from './variations';
import deprecated from './deprecated';
import { embedContentIcon } from './icons';

/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';

const { name } = metadata;
export { metadata, name };

export const settings = {
title: _x( 'Embed', 'block title' ),
description: __(
'Add a block that displays content pulled from other sites, like Twitter, Instagram or YouTube.'
),
icon: embedContentIcon,
edit,
save,
Expand Down
Loading

0 comments on commit 1fa873a

Please sign in to comment.