Skip to content

Commit

Permalink
fix lint issues with i18n strings
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube committed Sep 26, 2024
1 parent 58560ec commit 1423a1b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 52 deletions.
3 changes: 2 additions & 1 deletion src/app/components/errorCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const ErrorCard = ( { error, className, notice = 'Error!' } ) => {
<p>
{ error && error.message ? error.message : '' }
{ error && error.data
? __( ' Error code: ', 'wp-plugin-bluehost' ) +
? __( 'Error code:', 'wp-plugin-bluehost' ) +
' ' +
error.data.status
: '' }
</p>
Expand Down
1 change: 1 addition & 0 deletions src/app/pages/home/myProductsSection.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @wordpress/i18n-no-flanking-whitespace */
import apiFetch from '@wordpress/api-fetch';
import { useState, useEffect } from '@wordpress/element';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
Expand Down
46 changes: 20 additions & 26 deletions src/app/pages/settings/commentSettings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global sprintf */
import { useState } from '@wordpress/element';
import { useUpdateEffect } from 'react-use';
import {
Expand All @@ -9,7 +10,6 @@ import {
import AppStore from '../../data/store';
import { bluehostSettingsApiFetch } from '../../util/helpers';
import { useNotification } from 'App/components/notifications';

const OldPostsComments = ( { setError, notify } ) => {
const { store, setStore } = useContext( AppStore );
const [ disableCommentsOldPosts, setDisableCommentsOldPosts ] = useState(
Expand Down Expand Up @@ -78,37 +78,32 @@ const CloseCommentsDays = ( { setError, notify } ) => {
);

const closeCommentsDaysNoticeTitle = () => {
return __( 'Comments setting saved ', 'wp-plugin-bluehost' );
return __( 'Comments setting saved', 'wp-plugin-bluehost' );
};

const closeCommentsDaysNoticeText = () => {
//`Comments on posts are disabled after ${closeCommentsDays} days.`
return (
__(
'Comments on posts are disabled after ',
'wp-plugin-bluehost'
) +
closeCommentsDays +
return sprintf(
//translators: %s: number of days. `Comments on posts are disabled after ${closeCommentsDays} days.`
_n(
' day.',
' days.',
'Comments on posts are disabled after %s day.',
'Comments on posts are disabled after %s days.',
parseInt( closeCommentsDays ),
'wp-plugin-bluehost'
)
),
closeCommentsDays
);
};

const closeCommentsDaysLabelText = () => {
//`Close comments after ${closeCommentsDays} days.`
return (
__( 'Close comments after ', 'wp-plugin-bluehost' ) +
closeCommentsDays +
return sprintf(
//translators: %s: number of days. `Close comments after ${closeCommentsDays} days.`
_n(
' day.',
' days.',
'Close comments after %s day.',
'Close comments after %s days.',
parseInt( closeCommentsDays ),
'wp-plugin-bluehost'
)
),
closeCommentsDays
);
};

Expand Down Expand Up @@ -178,16 +173,15 @@ const CommentsPerPage = ( { setError, notify } ) => {
};

const commentsPerPageNoticeText = () => {
//`Posts will display ${commentsPerPage} comments at a time.`
return (
__( 'Posts will display ', 'wp-plugin-bluehost' ) +
commentsPerPage +
return sprintf(
//translators: %s: number of comments. `Posts will display ${commentsPerPage} comments at a time.`
_n(
' comment at a time.',
' comments at a time.',
'Posts will display %s comment at a time.',
'Posts will display %s comments at a time.',
parseInt( commentsPerPage ),
'wp-plugin-bluehost'
)
),
commentsPerPage
);
};

Expand Down
36 changes: 11 additions & 25 deletions src/app/pages/settings/contentSettings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global sprintf */
import { useState } from '@wordpress/element';
import { useUpdateEffect } from 'react-use';
import { Alert, Container, SelectField } from '@newfold/ui-component-library';
Expand All @@ -13,22 +14,19 @@ const EmptyTrash = ( { setError, notify } ) => {
let numTrashWeeks = Math.floor( emptyTrashDays / 7 );

const emptyTrashNoticeTitle = () => {
return __( 'Trash setting saved ', 'wp-plugin-bluehost' );
return __( 'Trash setting saved', 'wp-plugin-bluehost' );
};

const emptyTrashNoticeText = () => {
return (
__(
'The trash will automatically empty every ',
'wp-plugin-bluehost'
) +
numTrashWeeks +
return sprintf(
//translators: %s: number of weeks. `The trash will automatically empty every ${numTrashWeeks} weeks.`
_n(
' week.',
' weeks.',
'The trash will automatically empty every %s week.',
'The trash will automatically empty every %s weeks.',
parseInt( numTrashWeeks ),
'wp-plugin-bluehost'
)
),
numTrashWeeks
);
};

Expand Down Expand Up @@ -66,22 +64,10 @@ const EmptyTrash = ( { setError, notify } ) => {
<SelectField
id="empty-trash-select"
label={ __(
'Number of weeks in between emptying trash ',
'Number of weeks in between emptying trash',
'wp-plugin-bluehost'
) }
description={
__(
'The trash will automatically empty every ',
'wp-plugin-bluehost'
) +
numTrashWeeks +
_n(
' week.',
' weeks.',
parseInt( numTrashWeeks ),
'wp-plugin-bluehost'
)
}
description={ emptyTrashNoticeText() }
value={ emptyTrashDays }
selectedLabel={ numTrashWeeks }
options={ [
Expand All @@ -104,7 +90,7 @@ const ContentSettings = () => {
<Container.SettingsField
title={ __( 'Content Options', 'wp-plugin-bluehost' ) }
description={ __(
'Controls for content revisions and how often to empty the trash.',
'Controls for how often to empty the trash.',
'wp-plugin-bluehost'
) }
>
Expand Down

0 comments on commit 1423a1b

Please sign in to comment.