diff --git a/src/blocks/blocks/button-group/group/deprecated.js b/src/blocks/blocks/button-group/group/deprecated.js index 172396a2d..35d0de1c5 100644 --- a/src/blocks/blocks/button-group/group/deprecated.js +++ b/src/blocks/blocks/button-group/group/deprecated.js @@ -152,6 +152,7 @@ const deprecated = [{ padding: `${ attributes.data[i].paddingTopBottom }px ${ attributes.data[i].paddingLeftRight }px` }; + /* eslint-disable react/jsx-no-target-blank */ return ( { ( 'left' === attributes.data[i].iconType || 'only' === attributes.data[i].iconType ) && ( ); + /* eslint-enable react/jsx-no-target-blank */ }; return ( diff --git a/src/blocks/blocks/form/edit.js b/src/blocks/blocks/form/edit.js index 5478ad261..3a6ff7a42 100644 --- a/src/blocks/blocks/form/edit.js +++ b/src/blocks/blocks/form/edit.js @@ -10,7 +10,7 @@ import hash from 'object-hash'; /** * WordPress dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import api from '@wordpress/api'; @@ -651,7 +651,11 @@ const Edit = ({ } else { createNotice( 'error', - __( 'An error has occurred:', 'otter-blocks' ) + ( res?.error || __( 'unknown', 'otter-blocks' ) ), + sprintf( + // translators: %1$s the error message of the test email + __( 'An error has occurred: %1$s', 'otter-blocks' ), + res?.error || __( 'unknown', 'otter-blocks' ) + ), { isDismissible: true, type: 'snackbar' @@ -700,7 +704,11 @@ const Edit = ({ } else { createNotice( 'error', - __( 'An error has occurred:', 'otter-blocks' ) + ( res?.error || __( 'unknown', 'otter-blocks' ) + __( '. Check your provider for confirmation.', 'otter-blocks' ) ), + sprintf( + // translators: %s is the error message from the email provider. + __( 'An error has occurred: %s. Check your provider for confirmation.', 'otter-blocks' ), + res?.error || __( 'unknown', 'otter-blocks' ) + ), { isDismissible: true, type: 'snackbar' diff --git a/src/blocks/blocks/icon-list/item/edit.js b/src/blocks/blocks/icon-list/item/edit.js index 75f1351ee..4e5f38c45 100644 --- a/src/blocks/blocks/icon-list/item/edit.js +++ b/src/blocks/blocks/icon-list/item/edit.js @@ -6,7 +6,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { RichText, @@ -100,7 +100,8 @@ const Edit = ({ const parentClientId = select( 'core/block-editor' ).getBlockParents( clientId ).at( -1 ); const parentBlock = select( 'core/block-editor' ).getBlock( parentClientId ); - setAttributes({ content: __( 'List item', 'otter-blocks' ) + parentBlock.innerBlocks.length }); + // translators: %d: the number of List item blocks. + setAttributes({ content: sprintf( __( 'List item %d', 'otter-blocks' ), parentBlock.innerBlocks.length ) }); } }, []); @@ -126,7 +127,8 @@ const Edit = ({
{ 'image' === attributes.library && isURL ? ( - + /* eslint-disable-next-line jsx-a11y/alt-text */ + ) : ( 'themeisle-icons' === attributes.library && attributes.icon && Icon !== undefined ? ( } if ( attributes.displayAuthor && undefined !== author ) { - - /* translators: %s Author of the post */ - postedOn += sprintf( __( 'by %s', 'otter-blocks' ), author.name ); + + /* translators: %1$s is the date, %2$s is the author of the post */ + postedOn = sprintf( __( '%1$s by %2$s', 'otter-blocks' ), postedOn, author.name ); } meta.push( postedOn ); diff --git a/src/blocks/blocks/slider/deprecated.js b/src/blocks/blocks/slider/deprecated.js index ae1306482..748f73953 100644 --- a/src/blocks/blocks/slider/deprecated.js +++ b/src/blocks/blocks/slider/deprecated.js @@ -110,32 +110,35 @@ const deprecated = [{ height: `${ attributes.height }px` } } > - { attributes.images.map( image => { - return ( -
-
- { - - { ! RichText.isEmpty( image.caption ) && ( - { + return ( + // eslint-disable-next-line react/jsx-key +
+
+ { - ) } -
-
- ); - }) } + + { ! RichText.isEmpty( image.caption ) && ( + + ) } +
+
+ ); + }) + }
@@ -191,13 +194,14 @@ const deprecated = [{
{ attributes.images.map( image => { return ( + // eslint-disable-next-line react/jsx-key
{ { const itemBlock = createBlock( 'themeisle-blocks/tabs-item', { - title: __( 'Tab', 'otter-blocks' ) + ( ( children?.length ?? 0 ) + 1 ) + title: sprintf( + // Translators: %d is the tab number. + __( 'Tab %d', 'otter-blocks' ), + ( children?.length ?? 0 ) + 1 + ) }); insertBlock( itemBlock, ( children?.length ) || 0, clientId, false ); }; diff --git a/src/blocks/components/prompt/index.tsx b/src/blocks/components/prompt/index.tsx index 1d029c406..e7c6cf13c 100644 --- a/src/blocks/components/prompt/index.tsx +++ b/src/blocks/components/prompt/index.tsx @@ -2,7 +2,7 @@ * WordPress dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { closeSmall, redo, undo } from '@wordpress/icons'; import { ReactNode } from 'react'; import { Button, ExternalLink, Notice, Placeholder, Spinner, TextControl } from '@wordpress/components'; @@ -204,7 +204,13 @@ const PromptPlaceholder = ( props: PromptPlaceholderProps ) => { return; } - setTokenUsageDescription( __( 'Used tokens:', 'otter-blocks' ) + resultHistory[ resultHistoryIndex ].meta.usedToken ); + setTokenUsageDescription( + sprintf( + // translators: %d: number of used tokens + __( 'Used tokens: %d', 'otter-blocks' ), + resultHistory[ resultHistoryIndex ].meta.usedToken + ) + ); props.onPreview?.( resultHistory[ resultHistoryIndex ].result ); }, [ resultHistoryIndex, resultHistory ]); diff --git a/src/blocks/components/typography-selector-control/index.tsx b/src/blocks/components/typography-selector-control/index.tsx index 829358c2d..3fd7ae8e9 100644 --- a/src/blocks/components/typography-selector-control/index.tsx +++ b/src/blocks/components/typography-selector-control/index.tsx @@ -296,7 +296,7 @@ const TypographySelectorControl = ( props: TypographySelectorControlProps ) => { { defaultStates.componentNames?.[component] } ; } - return ; + return <>; }) } diff --git a/src/blocks/frontend/live-search/index.ts b/src/blocks/frontend/live-search/index.ts index b9c07ae7a..b7932d275 100644 --- a/src/blocks/frontend/live-search/index.ts +++ b/src/blocks/frontend/live-search/index.ts @@ -222,23 +222,23 @@ domReady( () => { const keyEvent = event as KeyboardEvent; const keys = [ 'ArrowDown', 'ArrowUp', 'Escape' ]; - + if ( ! keys.includes( keyEvent.key ) ) { return; } - + if ( 'Escape' === keyEvent.key ) { inputElement.blur(); resultsContainer = removeResultsContainer( block, resultsContainer ); return; } - + const highlighted = resultsContainer?.querySelector( '.highlight' ); if ( ! highlighted ) { highlight( resultsContainer.children[0] as HTMLElement, inputElement ); return; } - + const containerDimensions = resultsContainer.parentElement.getBoundingClientRect(); if ( 'ArrowDown' === keyEvent.key && highlighted.nextElementSibling ) { diff --git a/src/blocks/plugins/dynamic-content/media/index.js b/src/blocks/plugins/dynamic-content/media/index.js index a903b1a29..271d8c6dc 100644 --- a/src/blocks/plugins/dynamic-content/media/index.js +++ b/src/blocks/plugins/dynamic-content/media/index.js @@ -100,12 +100,12 @@ if ( Boolean( window.themeisleGutenberg.hasModule.dynamicContent ) ) { if ( ! activeFrame ) { return false; } - + const modal = activeFrame.querySelector( '.media-frame-content' ); if ( ! modal ) { return false; } - + modal.innerHTML = ''; modal.appendChild( createWrapperHTML() ); diff --git a/src/blocks/plugins/upsell-block/index.js b/src/blocks/plugins/upsell-block/index.js index 93eaae6e1..bd8e24b11 100644 --- a/src/blocks/plugins/upsell-block/index.js +++ b/src/blocks/plugins/upsell-block/index.js @@ -62,7 +62,8 @@ const edit = props => {

{ __( 'There are 30+ more patterns and full page designs available in Otter PRO.', 'otter-blocks' ) }

- + {/* eslint-disable-next-line react/jsx-no-target-blank */} + { __( 'View Demos', 'otter-blocks' ) } diff --git a/src/css/inject-css.js b/src/css/inject-css.js index 2fcad2fc5..358738c9c 100644 --- a/src/css/inject-css.js +++ b/src/css/inject-css.js @@ -115,7 +115,7 @@ const debouncedSubscription = debounce( () => { isTyping } = select( 'core/block-editor' ); const isTypingNow = isTyping(); - + if ( isTypingNow ) { return; } diff --git a/src/dashboard/components/Main.js b/src/dashboard/components/Main.js index 6d0c4f99c..b9c239af6 100644 --- a/src/dashboard/components/Main.js +++ b/src/dashboard/components/Main.js @@ -103,7 +103,8 @@ const Main = ({ - + {/* eslint-disable-next-line jsx-a11y/alt-text */} +

{ __( 'What\'s the one thing you need in Otter Blocks?', 'otter-blocks' ) }

{ __( 'We\'re always looking for suggestions to further improve Otter Blocks and your feedback can help us do that.', 'otter-blocks' ) } diff --git a/src/dashboard/components/NeveSidebarUpsell.js b/src/dashboard/components/NeveSidebarUpsell.js index b61aec29a..e7d8b2365 100644 --- a/src/dashboard/components/NeveSidebarUpsell.js +++ b/src/dashboard/components/NeveSidebarUpsell.js @@ -100,7 +100,8 @@ const NeveSidebarUpsell = () => {
- + {/* eslint-disable-next-line jsx-a11y/alt-text */} +

{ __( '- Experience lightning fast performance!', 'otter-blocks' ) }

@@ -115,7 +116,8 @@ const NeveSidebarUpsell = () => {
1050+ - + {/* eslint-disable-next-line jsx-a11y/alt-text */} +
@@ -128,7 +130,8 @@ const NeveSidebarUpsell = () => {
- + {/* eslint-disable-next-line jsx-a11y/alt-text */} +
)} diff --git a/src/pro/blocks/form-hidden-field/edit.js b/src/pro/blocks/form-hidden-field/edit.js index 4008967fc..25b0c2546 100644 --- a/src/pro/blocks/form-hidden-field/edit.js +++ b/src/pro/blocks/form-hidden-field/edit.js @@ -2,8 +2,8 @@ * WordPress dependencies */ -import { Fragment, useContext, useEffect } from '@wordpress/element'; -import { __ } from '@wordpress/i18n'; +import { Fragment, useEffect } from '@wordpress/element'; +import { __, sprintf } from '@wordpress/i18n'; import { RichText, useBlockProps } from '@wordpress/block-editor'; /** @@ -44,7 +44,11 @@ const Edit = ({ className: 'wp-block wp-block-themeisle-blocks-form-input' }); - const placeholder = attributes.paramName ? __( 'Get the value of the URL param:', 'otter-blocks' ) + attributes.paramName : ''; + const placeholder = attributes.paramName ? sprintf( + /* translators: %s: URL parameter name */ + __( 'Get the value of the URL param: %s', 'otter-blocks' ), + attributes.paramName + ) : ''; return ( diff --git a/src/pro/components/webhook-editor/index.tsx b/src/pro/components/webhook-editor/index.tsx index 638b247b6..070ab31ab 100644 --- a/src/pro/components/webhook-editor/index.tsx +++ b/src/pro/components/webhook-editor/index.tsx @@ -16,7 +16,7 @@ import { Spinner, TextControl } from '@wordpress/components'; -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { useEffect, useState, Fragment } from '@wordpress/element'; import { arrowRight, closeSmall } from '@wordpress/icons'; @@ -94,7 +94,11 @@ const WebhookEditor = ( props: WebhookEditorProps ) => { for ( const webhook of webhooksToSave ) { const check = checkWebhook( webhook ); if ( true !== check ) { - const msg = __( 'There was an error saving the webhook:', 'otter-blocks' ) + webhook?.name + '\n'; + const msg = sprintf( + /* translators: %s: webhook name */ + __( 'There was an error saving the webhook: %s', 'otter-blocks' ), + webhook?.name + ) + '\n'; setError( msg + check ); return; }