Skip to content

Commit 3a11fe9

Browse files
committed
Clean up i18n strings for the entire plugin
Signed-off-by: Atif Ali <atali@redhat.com>
1 parent 2211da2 commit 3a11fe9

File tree

9 files changed

+68
-31
lines changed

9 files changed

+68
-31
lines changed

locales/en/plugin__gitops-plugin.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,25 @@
7171
"Delete ApplicationSet": "Delete ApplicationSet",
7272
"Generators": "Generators",
7373
"Healthy": "Healthy",
74-
"Error": "Error"
74+
"Error": "Error",
75+
"Unable to load data": "Unable to load data",
76+
"There was an error retrieving applicationsets. Check your connection and reload the page.": "There was an error retrieving applicationsets. Check your connection and reload the page.",
77+
"There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.",
78+
"No matching Argo CD Applications": "No matching Argo CD Applications",
79+
"No Argo CD Applications": "No Argo CD Applications",
80+
"No Argo CD Applications match the label filter": "No Argo CD Applications match the label filter",
81+
"Try removing the filter or selecting a different label to see more applications.": "Try removing the filter or selecting a different label to see more applications.",
82+
"There are no Argo CD Applications in this project.": "There are no Argo CD Applications in this project.",
83+
"There are no Argo CD Applications in all projects.": "There are no Argo CD Applications in all projects.",
84+
"There is no history associated with the application.": "There is no history associated with the application.",
85+
"No resources": "No resources",
86+
"There are no resources associated with the application.": "There are no resources associated with the application.",
87+
"No source": "No source",
88+
"Error. There must at least one source in the application.": "Error. There must at least one source in the application.",
89+
"No Argo Rollouts": "No Argo Rollouts",
90+
"View ApplicationSet": "View ApplicationSet",
91+
"View Application": "View Application",
92+
"No owner": "No owner",
93+
"There are no Argo Rollouts in this project.": "There are no Argo Rollouts in this project.",
94+
"There are no Argo Rollouts in all projects.": "There are no Argo Rollouts in all projects."
7595
}

src/gitops/components/application/ApplicationResourcesTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ const ApplicationResourcesTab: React.FC<ApplicationResourcesTabProps> = ({ obj }
129129
<Tbody>
130130
<Tr key="loading" ouiaId="table-tr-loading">
131131
<Td colSpan={columnsDV.length}>
132-
<EmptyState headingLevel="h4" icon={CubesIcon} titleText="No resources">
132+
<EmptyState headingLevel="h4" icon={CubesIcon} titleText={t('No resources')}>
133133
<EmptyStateBody>
134-
There are no resources asssociated with the application.
134+
{t('There are no resources associated with the application.')}
135135
</EmptyStateBody>
136136
</EmptyState>
137137
</Td>

src/gitops/components/application/ApplicationSourcesTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ export const SourceList: React.FC<SourceListProps> = ({ sources, obj, argoServer
189189
<Tbody>
190190
<Tr key="loading" ouiaId="table-tr-loading">
191191
<Td colSpan={columns.length}>
192-
<EmptyState headingLevel="h4" icon={CubesIcon} titleText="No source">
192+
<EmptyState headingLevel="h4" icon={CubesIcon} titleText={t('No source')}>
193193
<EmptyStateBody>
194-
Error. There must at least one source in the application..
194+
{t('Error. There must at least one source in the application.')}
195195
</EmptyStateBody>
196196
</EmptyState>
197197
</Td>

src/gitops/components/application/ApplicationSyncStatusTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ const ApplicationSyncStatusTab: React.FC<ApplicationSyncStatusTabProps> = ({ obj
129129
<Tbody>
130130
<Tr key="loading" ouiaId="table-tr-loading">
131131
<Td colSpan={columnsDV.length}>
132-
<EmptyState headingLevel="h4" icon={CubesIcon} titleText="No resources">
132+
<EmptyState headingLevel="h4" icon={CubesIcon} titleText={t('No resources')}>
133133
<EmptyStateBody>
134-
There are no resources asssociated with the application.
134+
{t('There are no resources associated with the application.')}
135135
</EmptyStateBody>
136136
</EmptyState>
137137
</Td>

src/gitops/components/application/History/History.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react';
2+
import { useTranslation } from 'react-i18next';
23
import { useSearchParams } from 'react-router-dom-v5-compat';
34
import ExternalLink from 'src/components/utils/ExternalLink/ExternalLink';
45

@@ -26,6 +27,7 @@ interface HistoryListProps {
2627
}
2728

2829
const HistoryList: React.FC<HistoryListProps> = ({ history, obj }) => {
30+
const { t } = useTranslation('plugin__gitops-plugin');
2931
const COLUMNS_KEYS_INDEXES = React.useMemo(
3032
() => [
3133
{ key: 'id', index: 0 },
@@ -86,8 +88,10 @@ const HistoryList: React.FC<HistoryListProps> = ({ history, obj }) => {
8688
<Tbody>
8789
<Tr key="loading" ouiaId="table-tr-loading">
8890
<Td colSpan={columnsDV.length}>
89-
<EmptyState headingLevel="h4" icon={CubesIcon} titleText="No history">
90-
<EmptyStateBody>There is no history asssociated with the application.</EmptyStateBody>
91+
<EmptyState headingLevel="h4" icon={CubesIcon} titleText={t('No history')}>
92+
<EmptyStateBody>
93+
{t('There is no history associated with the application.')}
94+
</EmptyStateBody>
9195
</EmptyState>
9296
</Td>
9397
</Tr>

src/gitops/components/rollout/RolloutList.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,11 @@ const RolloutList: React.FC<RolloutListTabProps> = ({
157157
<Tbody>
158158
<Tr key="loading" ouiaId="table-tr-loading">
159159
<Td colSpan={columnsDV.length}>
160-
<EmptyState headingLevel="h4" icon={CubesIcon} titleText={'No Argo Rollouts'}>
160+
<EmptyState headingLevel="h4" icon={CubesIcon} titleText={t('No Argo Rollouts')}>
161161
<EmptyStateBody>
162-
There are no Argo Rollouts in {namespace ? 'this project' : 'all projects'}.
162+
{namespace
163+
? t('There are no Argo Rollouts in this project.')
164+
: t('There are no Argo Rollouts in all projects.')}
163165
</EmptyStateBody>
164166
</EmptyState>
165167
</Td>
@@ -171,8 +173,10 @@ const RolloutList: React.FC<RolloutListTabProps> = ({
171173
<Tr key="loading" ouiaId={'table-tr-loading'}>
172174
<Td colSpan={columnsDV.length}>
173175
<ErrorState
174-
titleText="Unable to load data"
175-
bodyText="There was an error retrieving applications. Check your connection and reload the page."
176+
titleText={t('Unable to load data')}
177+
bodyText={t(
178+
'There was an error retrieving applications. Check your connection and reload the page.',
179+
)}
176180
/>
177181
</Td>
178182
</Tr>

src/gitops/components/shared/ApplicationList.tsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,28 @@ const ApplicationList: React.FC<ApplicationProps> = ({
164164
<EmptyState
165165
headingLevel="h4"
166166
icon={CubesIcon}
167-
titleText={searchQuery ? 'No matching Argo CD Applications' : 'No Argo CD Applications'}
167+
titleText={
168+
searchQuery ? t('No matching Argo CD Applications') : t('No Argo CD Applications')
169+
}
168170
>
169171
<EmptyStateBody>
170-
{searchQuery ? (
171-
<>
172-
No Argo CD Applications match the label filter{' '}
173-
<strong>&quot;{searchQuery}&quot;</strong>.
174-
<br />
175-
Try removing the filter or selecting a different label to see more applications.
176-
</>
177-
) : (
178-
`There are no Argo CD Applications in ${
179-
namespace ? 'this project' : 'all projects'
180-
}.`
181-
)}
172+
{(() => {
173+
if (searchQuery) {
174+
return (
175+
<>
176+
{t('No Argo CD Applications match the label filter')}{' '}
177+
<strong>&quot;{searchQuery}&quot;</strong>.
178+
<br />
179+
{t(
180+
'Try removing the filter or selecting a different label to see more applications.',
181+
)}
182+
</>
183+
);
184+
}
185+
return namespace
186+
? t('There are no Argo CD Applications in this project.')
187+
: t('There are no Argo CD Applications in all projects.');
188+
})()}
182189
</EmptyStateBody>
183190
</EmptyState>
184191
</Td>

src/gitops/components/shared/ApplicationSetList.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,10 @@ const ApplicationSetList: React.FC<ApplicationSetProps> = ({
239239
<Tr key="loading" ouiaId={'table-tr-loading'}>
240240
<Td colSpan={columnsDV.length}>
241241
<ErrorState
242-
titleText="Unable to load data"
243-
bodyText="There was an error retrieving applicationsets. Check your connection and reload the page."
242+
titleText={t('Unable to load data')}
243+
bodyText={t(
244+
'There was an error retrieving applicationsets. Check your connection and reload the page.',
245+
)}
244246
/>
245247
</Td>
246248
</Tr>

src/gitops/utils/hooks/useGitOpsTranslation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { getI18n, useTranslation } from 'react-i18next';
33
/**
44
* A Hook for using the i18n translation.
55
*/
6-
export const useGitOpsTranslation = () => useTranslation('plugin__gitops-admin-plugin');
6+
export const useGitOpsTranslation = () => useTranslation('plugin__gitops-plugin');
77

88
/**
9-
* a function to perform translation to 'plugin__gitops-admin-plugin' namespace
9+
* a function to perform translation to 'plugin__gitops-plugin' namespace
1010
* @param value string to translate
1111
*/
1212
// skipcq: JS-C1002
13-
export const t = (value: string) => getI18n().t(value, { ns: 'plugin__gitops-admin-plugin' });
13+
export const t = (value: string) => getI18n().t(value, { ns: 'plugin__gitops-plugin' });

0 commit comments

Comments
 (0)