Skip to content

Commit

Permalink
fix: translation review
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Oct 21, 2024
1 parent 2a1c6ba commit 5af80c0
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 40 deletions.
4 changes: 3 additions & 1 deletion src/blocks/blocks/button-group/group/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Fragment>
<a
Expand All @@ -161,7 +162,7 @@ const deprecated = [{
'wp-block-themeisle-blocks-button',
`wp-block-themeisle-blocks-button-${ i }`
) }
style={ buttonStyle } rel="noreferrer"
style={ buttonStyle }
>
{ ( 'left' === attributes.data[i].iconType || 'only' === attributes.data[i].iconType ) && (
<i className={ classnames(
Expand All @@ -186,6 +187,7 @@ const deprecated = [{
</a>
</Fragment>
);
/* eslint-enable react/jsx-no-target-blank */
};

return (
Expand Down
14 changes: 11 additions & 3 deletions src/blocks/blocks/form/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down
8 changes: 5 additions & 3 deletions src/blocks/blocks/icon-list/item/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import classnames from 'classnames';
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';

import {
RichText,
Expand Down Expand Up @@ -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 ) });
}
}, []);

Expand All @@ -126,7 +127,8 @@ const Edit = ({

<div { ...blockProps }>
{ 'image' === attributes.library && isURL ? (
<img src={ attributes.icon } alt="" />
/* eslint-disable-next-line jsx-a11y/alt-text */
<img src={ attributes.icon } />
) : (
'themeisle-icons' === attributes.library && attributes.icon && Icon !== undefined ? (
<Icon
Expand Down
5 changes: 3 additions & 2 deletions src/blocks/blocks/leaflet-map/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
merge
} from 'lodash';

import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';

import { useBlockProps } from '@wordpress/block-editor';

Expand Down Expand Up @@ -157,7 +157,8 @@ const Edit = ({
});

default:
console.warn( __( 'The action for the leaflet block do not have a defined action in marker\'s reducer:', 'otter-blocks' ) + action.type );
// translators: %s is the action type that is not defined in the marker's reducer
console.warn( sprintf( __( 'The action for the leaflet block do not have a defined action in marker\'s reducer: %s', 'otter-blocks' ), action.type ) );
}

return oldState;
Expand Down
10 changes: 8 additions & 2 deletions src/blocks/blocks/leaflet-map/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ async function makeSearchRequest( location ) {
if ( response.ok && 200 === response.status ) {
return response.json();
}

return console.warn( __( 'An error has occured:', 'otter-blocks' ) + response.status );

return console.warn(
sprintf(
// translators: %s: HTTP status code
__( 'An error has occurred: %s', 'otter-blocks' ),
response.status
)
);
}

export async function getLocation( location ) {
Expand Down
6 changes: 3 additions & 3 deletions src/blocks/blocks/posts/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ export const PostsMeta = ({ attributes, element, post, author, categories }) =>
}

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 );
Expand Down
56 changes: 30 additions & 26 deletions src/blocks/blocks/slider/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,32 +110,35 @@ const deprecated = [{
height: `${ attributes.height }px`
} }
>
{ attributes.images.map( image => {
return (
<div
key={ image.id }
className="wp-block-themeisle-blocks-slider-item-wrapper glide__slide"
tabIndex="0"
>
<figure>
<img
className="wp-block-themeisle-blocks-slider-item"
src={ image.url }
alt={ image.alt }
title={ image.alt }
data-id={ image.id }
/>

{ ! RichText.isEmpty( image.caption ) && (
<RichText.Content
tagName="figcaption"
value={ image.caption }
{
attributes.images.map( image => {
return (
// eslint-disable-next-line react/jsx-key
<div
className="wp-block-themeisle-blocks-slider-item-wrapper glide__slide"
tabIndex="0"
>
<figure>
<img
key={ image.id }
className="wp-block-themeisle-blocks-slider-item"
src={ image.url }
alt={ image.alt }
title={ image.alt }
data-id={ image.id }
/>
) }
</figure>
</div>
);
}) }

{ ! RichText.isEmpty( image.caption ) && (
<RichText.Content
tagName="figcaption"
value={ image.caption }
/>
) }
</figure>
</div>
);
})
}
</div>

<SliderControls attributes={ attributes } />
Expand Down Expand Up @@ -191,13 +194,14 @@ const deprecated = [{
<div className="glide__slides">
{ attributes.images.map( image => {
return (
// eslint-disable-next-line react/jsx-key
<div
key={ image.id }
className="wp-block-themeisle-blocks-slider-item-wrapper glide__slide"
tabIndex="0"
>
<figure>
<img
key={ image.id }
className="wp-block-themeisle-blocks-slider-item"
src={ image.url }
alt={ image.alt }
Expand Down

0 comments on commit 5af80c0

Please sign in to comment.