From a19ce976c5419849bb0db0cbaeee25fe175e5ed2 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Thu, 5 Mar 2020 15:40:28 +0100 Subject: [PATCH 1/3] Add text domains --- blocks/bauhaus-centenary/src/colors.js | 10 +++---- blocks/bauhaus-centenary/src/edit.js | 18 ++++++------- blocks/bauhaus-centenary/src/forms.js | 2 +- blocks/bauhaus-centenary/src/heights.js | 6 ++--- blocks/bauhaus-centenary/src/index.js | 2 +- blocks/bauhaus-centenary/src/ribbon.js | 2 +- blocks/bauhaus-centenary/src/year.js | 8 +++--- blocks/layout-grid/src/constants.js | 24 ++++++++--------- blocks/layout-grid/src/grid-column/edit.js | 8 +++--- blocks/layout-grid/src/grid/edit.js | 28 ++++++++++---------- blocks/layout-grid/src/index.js | 10 +++---- blocks/starscape/src/colorGradientOptions.js | 26 +++++++++--------- blocks/starscape/src/edit.js | 22 +++++++-------- blocks/starscape/src/index.js | 4 +-- 14 files changed, 85 insertions(+), 85 deletions(-) diff --git a/blocks/bauhaus-centenary/src/colors.js b/blocks/bauhaus-centenary/src/colors.js index c1512ce0..88a5859c 100644 --- a/blocks/bauhaus-centenary/src/colors.js +++ b/blocks/bauhaus-centenary/src/colors.js @@ -4,9 +4,9 @@ import { __ } from '@wordpress/i18n'; export default [ - { name: __( 'Black' ), color: '#000000' }, - { name: __( 'Blue' ), color: '#051BF4' }, - { name: __( 'Red' ), color: '#D32121' }, - { name: __( 'Yellow' ), color: '#F7FC1C' }, - { name: __( 'White' ), color: '#FFFFFF' }, + { name: __( 'Black', 'bauhaus-centenary' ), color: '#000000' }, + { name: __( 'Blue', 'bauhaus-centenary' ), color: '#051BF4' }, + { name: __( 'Red', 'bauhaus-centenary' ), color: '#D32121' }, + { name: __( 'Yellow', 'bauhaus-centenary' ), color: '#F7FC1C' }, + { name: __( 'White', 'bauhaus-centenary' ), color: '#FFFFFF' }, ]; diff --git a/blocks/bauhaus-centenary/src/edit.js b/blocks/bauhaus-centenary/src/edit.js index 24bca18c..654211aa 100644 --- a/blocks/bauhaus-centenary/src/edit.js +++ b/blocks/bauhaus-centenary/src/edit.js @@ -43,7 +43,7 @@ const Edit = ( { return ( <> - +
{ Object.entries( categories ).map( ( [ category, { label, preview } ] ) => { const isCategorySelected = category === attributes.category; @@ -79,32 +79,32 @@ const Edit = ( { { ExtraStyles && } setAttributes( { fill1Color } ), - label: __( 'Fill 1' ), + label: __( 'Fill 1', 'bauhaus-centenary' ), }, { colors, value: attributes.fill2Color, onChange: ( fill2Color ) => setAttributes( { fill2Color } ), - label: __( 'Fill 2' ), + label: __( 'Fill 2', 'bauhaus-centenary' ), }, { colors, value: attributes.fill3Color, onChange: ( fill3Color ) => setAttributes( { fill3Color } ), - label: __( 'Fill 3' ), + label: __( 'Fill 3', 'bauhaus-centenary' ), }, ] } /> @@ -124,7 +124,7 @@ const Edit = ( { { ( ! RichText.isEmpty( attributes.caption ) || isSelected ) && ( setAttributes( { caption } ) } inlineToolbar @@ -133,8 +133,8 @@ const Edit = ( { ) : ( } className={ className } > diff --git a/blocks/bauhaus-centenary/src/forms.js b/blocks/bauhaus-centenary/src/forms.js index 9b183235..c1c61b36 100644 --- a/blocks/bauhaus-centenary/src/forms.js +++ b/blocks/bauhaus-centenary/src/forms.js @@ -26,7 +26,7 @@ const Forms = ( { className, attributes } ) => { const Content = Forms; export default Object.assign( Forms, { - label: __( 'Forms' ), + label: __( 'Forms', 'bauhaus-centenary' ), icon: , preview: , Content, diff --git a/blocks/bauhaus-centenary/src/heights.js b/blocks/bauhaus-centenary/src/heights.js index 83ed895a..599abcc2 100644 --- a/blocks/bauhaus-centenary/src/heights.js +++ b/blocks/bauhaus-centenary/src/heights.js @@ -4,7 +4,7 @@ import { __ } from '@wordpress/i18n'; export default [ - { label: __( 'Small' ), value: 64 }, - { label: __( 'Medium' ), value: 128 }, - { label: __( 'Large' ), value: 256 }, + { label: __( 'Small', 'bauhaus-centenary' ), value: 64 }, + { label: __( 'Medium', 'bauhaus-centenary' ), value: 128 }, + { label: __( 'Large', 'bauhaus-centenary' ), value: 256 }, ]; diff --git a/blocks/bauhaus-centenary/src/index.js b/blocks/bauhaus-centenary/src/index.js index f29ca690..bad01b73 100644 --- a/blocks/bauhaus-centenary/src/index.js +++ b/blocks/bauhaus-centenary/src/index.js @@ -14,7 +14,7 @@ import { BauhausIcon } from './icon'; export const registerBlock = () => { registerBlockType( 'a8c/bauhaus-centenary', { title: 'Bauhaus Centenary', - description: __( 'Celebrate the centenary of the design school' ), + description: __( 'Celebrate the centenary of the design school', 'bauhaus-centenary' ), icon: BauhausIcon, category: 'widgets', supports: { diff --git a/blocks/bauhaus-centenary/src/ribbon.js b/blocks/bauhaus-centenary/src/ribbon.js index ee22109d..46350d01 100644 --- a/blocks/bauhaus-centenary/src/ribbon.js +++ b/blocks/bauhaus-centenary/src/ribbon.js @@ -42,7 +42,7 @@ const Ribbon = ( { attributes } ) => { const Content = Ribbon; export default Object.assign( Ribbon, { - label: __( 'Ribbon' ), + label: __( 'Ribbon', 'bauhaus-centenary' ), icon: , preview: , Content, diff --git a/blocks/bauhaus-centenary/src/year.js b/blocks/bauhaus-centenary/src/year.js index 310e394e..b1d4d5ca 100644 --- a/blocks/bauhaus-centenary/src/year.js +++ b/blocks/bauhaus-centenary/src/year.js @@ -33,9 +33,9 @@ const Content = Year; const ExtraStyles = ( { attributes, setAttributes } ) => ( setAttributes( { year } ) } @@ -43,7 +43,7 @@ const ExtraStyles = ( { attributes, setAttributes } ) => ( ); export default Object.assign( Year, { - label: __( 'Year' ), + label: __( 'Year', 'bauhaus-centenary' ), icon: , preview: , Content, diff --git a/blocks/layout-grid/src/constants.js b/blocks/layout-grid/src/constants.js index 4bafeea8..19bb0a35 100644 --- a/blocks/layout-grid/src/constants.js +++ b/blocks/layout-grid/src/constants.js @@ -5,28 +5,28 @@ import { __ } from '@wordpress/i18n'; export const getPaddingValues = () => ( [ - { value: 'none', label: __( 'No padding' ) }, - { value: 'small', label: __( 'Small' ) }, - { value: 'medium', label: __( 'Medium' ) }, - { value: 'large', label: __( 'Large' ) }, - { value: 'huge', label: __( 'Huge' ) }, + { value: 'none', label: __( 'No padding', 'layout-grid' ) }, + { value: 'small', label: __( 'Small', 'layout-grid' ) }, + { value: 'medium', label: __( 'Medium', 'layout-grid' ) }, + { value: 'large', label: __( 'Large', 'layout-grid' ) }, + { value: 'huge', label: __( 'Huge', 'layout-grid' ) }, ] ); export const getColumns = () => ( [ { - label: __( '1 column' ), + label: __( '1 column', 'layout-grid' ), value: 1, }, { - label: __( '2 columns' ), + label: __( '2 columns', 'layout-grid' ), value: 2, }, { - label: __( '3 columns' ), + label: __( '3 columns', 'layout-grid' ), value: 3, }, { - label: __( '4 columns' ), + label: __( '4 columns', 'layout-grid' ), value: 4, }, ] ); @@ -36,9 +36,9 @@ export const DEVICE_TABLET = 'Tablet'; export const DEVICE_MOBILE = 'Mobile'; export const getLayouts = () => ( [ - { value: DEVICE_DESKTOP, label: __( 'Desktop' ) }, - { value: DEVICE_TABLET, label: __( 'Tablet' ) }, - { value: DEVICE_MOBILE, label: __( 'Mobile' ) }, + { value: DEVICE_DESKTOP, label: __( 'Desktop', 'layout-grid' ) }, + { value: DEVICE_TABLET, label: __( 'Tablet', 'layout-grid' ) }, + { value: DEVICE_MOBILE, label: __( 'Mobile', 'layout-grid' ) }, ] ); export const MAX_COLUMNS = 4; diff --git a/blocks/layout-grid/src/grid-column/edit.js b/blocks/layout-grid/src/grid-column/edit.js index 4cecfa25..6fd95f7d 100644 --- a/blocks/layout-grid/src/grid-column/edit.js +++ b/blocks/layout-grid/src/grid-column/edit.js @@ -107,19 +107,19 @@ class Edit extends Component { - -

{ __( 'Choose padding for this column:' ) }

+ +

{ __( 'Choose padding for this column:', 'layout-grid' ) }

setAttributes( { padding: newValue } ) } diff --git a/blocks/layout-grid/src/grid/edit.js b/blocks/layout-grid/src/grid/edit.js index 4308b16b..eeafffcb 100644 --- a/blocks/layout-grid/src/grid/edit.js +++ b/blocks/layout-grid/src/grid/edit.js @@ -125,11 +125,11 @@ class Edit extends Component { settings.push( (
- { __( 'Column' ) } { column + 1 } + { __( 'Column', 'layout-grid' ) } { column + 1 }
    @@ -240,7 +240,7 @@ class Edit extends Component { /> - +
    { getColumns().map( ( column ) => (
    -

    { __( 'Changing the number of columns will reset your layout and could remove content.' ) }

    +

    { __( 'Changing the number of columns will reset your layout and could remove content.', 'layout-grid' ) }

    - +

    { __( "Note that previewing your post will show your browser's breakpoint, not the currently selected one." ) }

    { getLayouts().map( ( layout ) => ( @@ -292,11 +292,11 @@ class Edit extends Component { { this.renderDeviceSettings( columns, selectedDevice, attributes ) }
    - + setAttributes( { addGutterEnds: newValue } ) } diff --git a/blocks/layout-grid/src/index.js b/blocks/layout-grid/src/index.js index 953dc384..add43d45 100644 --- a/blocks/layout-grid/src/index.js +++ b/blocks/layout-grid/src/index.js @@ -31,8 +31,8 @@ function getColumnAttributes( total, breakpoints ) { export function registerBlock() { registerBlockType( 'jetpack/layout-grid', { - title: __( 'Layout Grid' ), - description: __( 'Align blocks to to a global grid, with support for responsive breakpoints.' ), + title: __( 'Layout Grid', 'layout-grid' ), + description: __( 'Align blocks to to a global grid, with support for responsive breakpoints.', 'layout-grid' ), icon: GridIcon, category: 'layout', supports: { @@ -51,7 +51,7 @@ export function registerBlock() { name: 'core/paragraph', attributes: { customFontSize: 32, - content: __( 'Snow Patrol' ), + content: __( 'Snow Patrol', 'layout-grid' ), align: 'center', }, }, @@ -86,8 +86,8 @@ export function registerBlock() { } ); registerBlockType( 'jetpack/layout-grid-column', { - description: __( 'A column used inside a Layout Grid block.' ), - title: __( 'Column' ), + description: __( 'A column used inside a Layout Grid block.', 'layout-grid' ), + title: __( 'Column', 'layout-grid' ), icon: GridIcon, category: 'layout', parent: [ 'jetpack/layout-grid' ], diff --git a/blocks/starscape/src/colorGradientOptions.js b/blocks/starscape/src/colorGradientOptions.js index 9fc2ce13..5ced062e 100644 --- a/blocks/starscape/src/colorGradientOptions.js +++ b/blocks/starscape/src/colorGradientOptions.js @@ -6,57 +6,57 @@ import { __ } from '@wordpress/i18n'; export default { gradients: [ { - name: __( 'Midnight' ), + name: __( 'Midnight', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(0, 0, 12) 0%,rgb(0, 0, 12) 100%)', }, { - name: __( 'Astronomical Dawn' ), + name: __( 'Astronomical Dawn', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(2, 1, 17) 60%,rgb(32, 32, 44) 100%)', }, { - name: __( 'Nautical Dawn' ), + name: __( 'Nautical Dawn', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(2, 1, 17) 10%,rgb(58, 58, 82) 100%)', }, { - name: __( 'Civil Dawn' ), + name: __( 'Civil Dawn', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(32, 32, 44) 0%,rgb(81, 81, 117) 100%)', }, { - name: __( 'Sunrise' ), + name: __( 'Sunrise', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(32, 32, 44) 0%,rgb(111, 113, 170) 80%,rgb(138, 118, 171) 100%)', }, { - name: __( 'Morning' ), + name: __( 'Morning', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(64, 64, 92) 0%,rgb(112, 114, 171) 50%,rgb(205, 130, 160) 100%)', }, { - name: __( 'Atmosphere' ), + name: __( 'Atmosphere', 'starscape' ), gradient: 'linear-gradient(180deg, rgb(0, 0, 12) 65%,rgb(27, 39, 65) 85%,rgb(46, 68, 115) 95%,rgb(68, 99, 163) 100%)', }, { - name: __( 'Astronomical Dusk' ), + name: __( 'Astronomical Dusk', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(11, 5, 11) 60%,rgb(39, 23, 28) 100%)', }, { - name: __( 'Nautical Dusk' ), + name: __( 'Nautical Dusk', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(11, 5, 11) 10%,rgb(76, 45, 47) 100%)', }, { - name: __( 'Civil Dusk' ), + name: __( 'Civil Dusk', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(19, 15, 19) 0%,rgb(47, 33, 34) 50%,rgb(108, 53, 58) 100%)', }, { - name: __( 'Sunset' ), + name: __( 'Sunset', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(30, 24, 24) 0%,rgb(47, 33, 34) 30%,rgb(108, 53, 58) 70%,rgb(207, 128, 75) 100%)', }, { - name: __( 'Evening' ), + name: __( 'Evening', 'starscape' ), gradient: 'linear-gradient(141deg, rgb(47, 33, 34) 10%,rgb(108, 53, 58) 40%,rgb(207, 128, 75) 80%,rgb(255, 235, 89) 100%)', }, ], colors: [ { - name: __( 'White' ), + name: __( 'White', 'starscape' ), color: '#ffffff', }, ], diff --git a/blocks/starscape/src/edit.js b/blocks/starscape/src/edit.js index 568e0fb5..fd709e89 100644 --- a/blocks/starscape/src/edit.js +++ b/blocks/starscape/src/edit.js @@ -50,9 +50,9 @@ const Edit = ( { /> - + setAttributes( { density, @@ -62,7 +62,7 @@ const Edit = ( { max={ 100 } /> setAttributes( { speed, @@ -73,28 +73,28 @@ const Edit = ( { /> setAttributes( { background } ), }, { - label: __( 'Text' ), + label: __( 'Text', 'starscape' ), colorValue: textColor.color, onColorChange: setTextColor, }, ] } /> - -

    { __( 'Control the area of stars you want. Smaller values have better performance, but blocks larger than the area specified will not be completely covered.' ) }

    + +

    { __( 'Control the area of stars you want. Smaller values have better performance, but blocks larger than the area specified will not be completely covered.', 'starscape' ) }

    setAttributes( { heading } ) } /> diff --git a/blocks/starscape/src/index.js b/blocks/starscape/src/index.js index 75880753..0b378741 100644 --- a/blocks/starscape/src/index.js +++ b/blocks/starscape/src/index.js @@ -27,8 +27,8 @@ import generated from './generated.json'; export function registerBlock() { registerBlockType( 'a8c/starscape', { - title: __( 'Starscape' ), - description: __( 'Create content with stars in motion.' ), + title: __( 'Starscape', 'starscape' ), + description: __( 'Create content with stars in motion.', 'starscape' ), icon: , category: 'widgets', supports: { From 34d581b59f045f2212b38326b790a92a38eba95f Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Thu, 5 Mar 2020 16:12:45 +0100 Subject: [PATCH 2/3] Add wp_set_script_translations --- blocks/layout-grid/index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blocks/layout-grid/index.php b/blocks/layout-grid/index.php index 74f40d16..4c575197 100644 --- a/blocks/layout-grid/index.php +++ b/blocks/layout-grid/index.php @@ -12,6 +12,8 @@ 'style' => 'wpcom-blocks', 'editor_style' => 'wpcom-blocks-editor', ] ); + + wp_set_script_translations( 'jetpack/layout-grid', 'layout-grid' ); } ); add_action( 'wp_head', function() { From 56646eb26c583ec7a0f9ef3ec2832755b5fad53b Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Thu, 5 Mar 2020 16:13:47 +0100 Subject: [PATCH 3/3] Add wp_set_script_translations --- blocks/bauhaus-centenary/index.php | 2 ++ blocks/starscape/index.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/blocks/bauhaus-centenary/index.php b/blocks/bauhaus-centenary/index.php index 22c10b68..c132c405 100644 --- a/blocks/bauhaus-centenary/index.php +++ b/blocks/bauhaus-centenary/index.php @@ -15,4 +15,6 @@ 'editor_style' => 'wpcom-blocks-editor', ] ); + + wp_set_script_translations( 'a8c/bauhaus-centenary', 'bauhaus-centenary' ); } ); diff --git a/blocks/starscape/index.php b/blocks/starscape/index.php index ed7f610e..c34d630a 100644 --- a/blocks/starscape/index.php +++ b/blocks/starscape/index.php @@ -6,4 +6,6 @@ 'style' => 'wpcom-blocks', 'editor_style' => 'wpcom-blocks-editor', ] ); + + wp_set_script_translations( 'a8c/starscape', 'starscape' ); } );