From 2320be207bd4a554277f784aa97d92f86cbe2dd9 Mon Sep 17 00:00:00 2001 From: rui ma Date: Tue, 20 Feb 2024 23:07:37 +0800 Subject: [PATCH] fix: revert suffix translation keys Signed-off-by: rui ma --- packages/core-components/api-report-alpha.md | 8 -------- .../src/components/AutoLogout/StillTherePrompt.tsx | 8 ++++---- .../EmptyState/MissingAnnotationEmptyState.tsx | 12 +++++------- packages/core-components/src/translation.ts | 10 ---------- 4 files changed, 9 insertions(+), 29 deletions(-) diff --git a/packages/core-components/api-report-alpha.md b/packages/core-components/api-report-alpha.md index 210485b38d..6cfada994e 100644 --- a/packages/core-components/api-report-alpha.md +++ b/packages/core-components/api-report-alpha.md @@ -38,10 +38,6 @@ export const coreComponentsTranslationRef: TranslationRef< readonly 'emptyState.missingAnnotation.title': 'Missing Annotation'; readonly 'emptyState.missingAnnotation.actionTitle': 'Add the annotation to your component YAML as shown in the highlighted example below:'; readonly 'emptyState.missingAnnotation.readMore': 'Read more'; - readonly 'emptyState.missingAnnotation.descriptionPrefix_one': 'The annotation '; - readonly 'emptyState.missingAnnotation.descriptionPrefix_other': 'The annotations '; - readonly 'emptyState.missingAnnotation.descriptionSuffix_one': ' is missing. You need to add the annotation to your component if you want to enable this tool.'; - readonly 'emptyState.missingAnnotation.descriptionSuffix_other': ' are missing. You need to add the annotations to your component if you want to enable this tool.'; readonly 'supportConfig.default.title': 'Support Not Configured'; readonly 'supportConfig.default.linkTitle': 'Add `app.support` config key'; readonly 'errorBoundary.title': 'Please contact {{slackChannel}} for help.'; @@ -54,10 +50,6 @@ export const coreComponentsTranslationRef: TranslationRef< readonly 'alertDisplay.message_one': '({{ count }} older message)'; readonly 'alertDisplay.message_other': '({{ count }} older messages)'; readonly 'autoLogout.stillTherePrompt.title': 'Logging out due to inactivity'; - readonly 'autoLogout.stillTherePrompt.description': 'You are about to be disconnected in'; - readonly 'autoLogout.stillTherePrompt.second_one': 'second'; - readonly 'autoLogout.stillTherePrompt.second_other': 'seconds'; - readonly 'autoLogout.stillTherePrompt.descriptionSuffix': 'Are you still there?'; readonly 'autoLogout.stillTherePrompt.buttonText': "Yes! Don't log me out"; readonly 'proxiedSignInPage.title': 'You do not appear to be signed in. Please try reloading the browser page.'; } diff --git a/packages/core-components/src/components/AutoLogout/StillTherePrompt.tsx b/packages/core-components/src/components/AutoLogout/StillTherePrompt.tsx index c704cf9910..9496199fd9 100644 --- a/packages/core-components/src/components/AutoLogout/StillTherePrompt.tsx +++ b/packages/core-components/src/components/AutoLogout/StillTherePrompt.tsx @@ -64,18 +64,18 @@ export const StillTherePrompt = (props: StillTherePromptProps) => { remainingTime - promptTimeoutMillis / 1000, 0, ); + const seconds = timeTillPrompt > 1 ? 'seconds' : 'second'; return ( {t('autoLogout.stillTherePrompt.title')} - {t('autoLogout.stillTherePrompt.description')}{' '} + You are about to be disconnected in{' '} - {Math.ceil(remainingTime / 1000)}{' '} - {t('autoLogout.stillTherePrompt.second', { count: timeTillPrompt })} + {Math.ceil(remainingTime / 1000)} {seconds} - . {t('autoLogout.stillTherePrompt.descriptionSuffix')} + . Are you still there? diff --git a/packages/core-components/src/components/EmptyState/MissingAnnotationEmptyState.tsx b/packages/core-components/src/components/EmptyState/MissingAnnotationEmptyState.tsx index 8c3f8c186f..e185dff8a6 100644 --- a/packages/core-components/src/components/EmptyState/MissingAnnotationEmptyState.tsx +++ b/packages/core-components/src/components/EmptyState/MissingAnnotationEmptyState.tsx @@ -79,12 +79,10 @@ function generateComponentYaml(annotations: string[]) { } function useGenerateDescription(annotations: string[]) { - const { t } = useTranslationRef(coreComponentsTranslationRef); + const isSingular = annotations.length <= 1; return ( <> - {t('emptyState.missingAnnotation.descriptionPrefix', { - count: annotations.length, - })} + The {isSingular ? 'annotation' : 'annotations'}{' '} {annotations .map(ann => {ann}) .reduce((prev, curr) => ( @@ -92,9 +90,9 @@ function useGenerateDescription(annotations: string[]) { {prev}, {curr} ))}{' '} - {t('emptyState.missingAnnotation.descriptionSuffix', { - count: annotations.length, - })} + {isSingular ? 'is' : 'are'} missing. You need to add the{' '} + {isSingular ? 'annotation' : 'annotations'} to your component if you want + to enable this tool. ); } diff --git a/packages/core-components/src/translation.ts b/packages/core-components/src/translation.ts index bb120f7c18..cc7fe1f3e1 100644 --- a/packages/core-components/src/translation.ts +++ b/packages/core-components/src/translation.ts @@ -63,12 +63,6 @@ export const coreComponentsTranslationRef = createTranslationRef({ actionTitle: 'Add the annotation to your component YAML as shown in the highlighted example below:', readMore: 'Read more', - descriptionPrefix_one: 'The annotation ', - descriptionPrefix_other: 'The annotations ', - descriptionSuffix_one: - ' is missing. You need to add the annotation to your component if you want to enable this tool.', - descriptionSuffix_other: - ' are missing. You need to add the annotations to your component if you want to enable this tool.', }, }, supportConfig: { @@ -106,10 +100,6 @@ export const coreComponentsTranslationRef = createTranslationRef({ autoLogout: { stillTherePrompt: { title: 'Logging out due to inactivity', - description: 'You are about to be disconnected in', - second_one: 'second', - second_other: 'seconds', - descriptionSuffix: 'Are you still there?', buttonText: "Yes! Don't log me out", }, },