Skip to content

Commit 10bcbfb

Browse files
authored
Merge pull request #928 from headlamp-k8s/i18n-fixes
frontend: Tidy translations
2 parents fc8c3c2 + e119e8b commit 10bcbfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+656
-276
lines changed

frontend/src/components/App/Notifications/List.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Empty from '../../common/EmptyContent';
1313
export default function NotificationList() {
1414
const notifications = useTypedSelector(state => state.ui.notifications);
1515
const config = useTypedSelector(state => state.config);
16-
const { t } = useTranslation();
16+
const { t } = useTranslation(['notifications', 'glossary', 'frequent']);
1717
const dispatch = useDispatch();
1818
const theme = useTheme();
1919
const search = useTypedSelector(state => state.filter.search);
@@ -72,10 +72,10 @@ export default function NotificationList() {
7272
</IconButton>
7373
<Menu anchorEl={anchorEl} open={Boolean(anchorEl)} onClose={handleClose}>
7474
<MenuItem onClick={markAllAsRead}>
75-
<Typography color={'primary'}>{t('Mark all as read')}</Typography>
75+
<Typography color={'primary'}>{t('notifications|Mark all as read')}</Typography>
7676
</MenuItem>
7777
<MenuItem onClick={clearAllNotifications}>
78-
<Typography color="primary">{t('Clear all')}</Typography>
78+
<Typography color="primary">{t('notifications|Clear all')}</Typography>
7979
</MenuItem>
8080
</Menu>
8181
</>
@@ -86,15 +86,15 @@ export default function NotificationList() {
8686
<SectionBox
8787
title={
8888
<SectionFilterHeader
89-
title={t('Notifications')}
89+
title={t('frequent|Notifications')}
9090
noNamespaceFilter
9191
actions={[<NotificationActionMenu />]}
9292
/>
9393
}
9494
backLink
9595
>
9696
{checkIfAllNotificationsDeleted() ? (
97-
<Empty>{t(`notifications|You don't have any notifications right now`)}</Empty>
97+
<Empty>{t("notifications|You don't have any notifications right now")}</Empty>
9898
) : (
9999
<SimpleTable
100100
filterFunction={(notification: Notification) =>
@@ -106,7 +106,7 @@ export default function NotificationList() {
106106
getter: (notification: Notification) => (
107107
<Box width={'30vw'}>
108108
<Tooltip
109-
title={`${t(`notifications|${notification.message}`)}`}
109+
title={notification.message || t('notifications|No message')}
110110
disableHoverListener={!notification.message}
111111
>
112112
<Typography
@@ -124,7 +124,7 @@ export default function NotificationList() {
124124
),
125125
},
126126
{
127-
label: t('Cluster'),
127+
label: t('glossary|Cluster'),
128128
getter: (notification: Notification) => (
129129
<Box display={'flex'} alignItems="center">
130130
{Object.entries(config?.clusters || {}).length > 1 && notification.cluster && (
@@ -143,7 +143,7 @@ export default function NotificationList() {
143143
),
144144
},
145145
{
146-
label: t('Date'),
146+
label: t('frequent|Date'),
147147
getter: (notification: Notification) => <DateLabel date={notification.date} />,
148148
},
149149
{

frontend/src/components/App/Notifications/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,18 @@ function NotificationsList(props: {
115115
onClick={() => notificationItemClickHandler(notification)}
116116
>
117117
<Grid item md={notification.seen ? 11 : 10}>
118-
<Tooltip title={`${t(`notifications|${notification.message}`)}`}>
118+
<Tooltip title={notification.message || t('notifications|No message')}>
119119
<Typography style={{ fontWeight: notification.seen ? 'normal' : 'bold' }} noWrap>
120-
{`${notification.message || t(`notifications|No message`)}`}
120+
{`${notification.message || t('notifications|No message')}`}
121121
</Typography>
122122
</Tooltip>
123123
</Grid>
124124
{!notification.seen && (
125125
<Grid item md={1}>
126-
<Tooltip title={t(`notifications|Mark as read`)}>
126+
<Tooltip title={t('notifications|Mark as read')}>
127127
<IconButton
128128
onClick={e => notificationSeenUnseenHandler(e, notification)}
129-
aria-label={t(`notifications|Mark as read`)}
129+
aria-label={t('notifications|Mark as read')}
130130
>
131131
<Icon icon="mdi:circle" color={theme.palette.error.main} height={12} width={12} />
132132
</IconButton>

frontend/src/components/App/settings/index.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ const useStyles = makeStyles(theme => ({
197197

198198
export default function Settings() {
199199
const classes = useStyles();
200-
const { t } = useTranslation(['settings']);
200+
const { t } = useTranslation(['settings', 'frequent']);
201201
const settingsObj = useSettings();
202202
const storedTimezone = settingsObj.timezone;
203203
const storedRowsPerPageOptions = settingsObj.tableRowsPerPageOptions;
@@ -216,7 +216,7 @@ export default function Settings() {
216216

217217
return (
218218
<SectionBox
219-
title={t('General')}
219+
title={t('frequent|General')}
220220
headerProps={{
221221
actions: [
222222
<ActionButton
@@ -235,23 +235,23 @@ export default function Settings() {
235235
valueCellProps={{ className: classes.valueCol }}
236236
rows={[
237237
{
238-
name: t('Language'),
238+
name: t('frequent|Language'),
239239
value: <LocaleSelect showFullNames formControlProps={{ className: '' }} />,
240240
},
241241
{
242-
name: t('Theme'),
242+
name: t('frequent|Theme'),
243243
value: <ThemeChangeButton showBothIcons />,
244244
},
245245
{
246-
name: t('Number of rows for tables'),
246+
name: t('settings|Number of rows for tables'),
247247
value: (
248248
<NumberOfRowsForTablesInputComponent
249249
defaultValue={storedRowsPerPageOptions || DefaultRowsPerPageOptions}
250250
/>
251251
),
252252
},
253253
{
254-
name: t('Timezone to display for dates'),
254+
name: t('settings|Timezone to display for dates'),
255255
value: (
256256
<Box maxWidth="350px">
257257
<TimezoneSelect
@@ -275,7 +275,7 @@ export function SettingsButton(props: { onClickExtra?: () => void }) {
275275
return (
276276
<ActionButton
277277
icon="mdi:cog"
278-
description={t('glossary|Settings')}
278+
description={t('frequent|Settings')}
279279
onClick={() => {
280280
history.push(createRouteURL('settings'));
281281
onClickExtra && onClickExtra();

frontend/src/components/common/ObjectEventList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function ObjectEventList(props: ObjectEventListProps) {
2323
}, []);
2424

2525
return (
26-
<SectionBox title={t('frequent|Events')}>
26+
<SectionBox title={t('glossary|Events')}>
2727
<SimpleTable
2828
columns={[
2929
{

frontend/src/components/common/Resource/CreateButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default function CreateButton() {
5353
}
5454
if (!massagedNewItemDefs[i].metadata?.name) {
5555
setErrorMessage(
56-
t(`resource|Invalid: One or more of the resource doesn't have a name property`)
56+
t(`resource|Invalid: One or more of resources doesn't have a name property`)
5757
);
5858
return;
5959
}

frontend/src/components/endpoints/Details.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import SimpleTable from '../common/SimpleTable';
1111
export default function EndpointDetails() {
1212
const { namespace, name } = useParams<{ namespace: string; name: string }>();
1313
const location = useLocation();
14-
const { t } = useTranslation('glossary');
14+
const { t } = useTranslation(['glossary', 'frequent']);
1515

1616
return (
1717
<DetailsGrid
@@ -31,7 +31,7 @@ export default function EndpointDetails() {
3131
) : (
3232
item.subsets?.map((subset, i) => (
3333
<SectionBox key={`subsetDetails_${i}`} outterBoxProps={{ pb: 3 }}>
34-
<SectionHeader noPadding title={t('Addresses')} headerStyle="label" />
34+
<SectionHeader noPadding title={t('frequent|Addresses')} headerStyle="label" />
3535
<SimpleTable
3636
data={subset?.addresses || []}
3737
columns={[
@@ -77,7 +77,7 @@ export default function EndpointDetails() {
7777
data={subset?.ports || []}
7878
columns={[
7979
{
80-
label: t('Name'),
80+
label: t('frequent|Name'),
8181
datum: 'name',
8282
sort: true,
8383
},

frontend/src/components/endpoints/List.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ import { SectionBox } from '../common/SectionBox';
66
import SectionFilterHeader from '../common/SectionFilterHeader';
77

88
export default function EndpointList() {
9-
const { t } = useTranslation('glossary');
9+
const { t } = useTranslation(['glossary', 'frequent']);
1010
const filterFunc = useFilterFunc([
1111
'.jsonData.subsets[*].addresses[*].ip',
1212
'.jsonData.subsets[*].ports[*].port',
1313
'.jsonData.subsets[*].ports[*].name',
1414
]);
1515

1616
return (
17-
<SectionBox title={<SectionFilterHeader title={t('Endpoints')} />}>
17+
<SectionBox title={<SectionFilterHeader title={t('glossary|Endpoints')} />}>
1818
<ResourceTable
1919
resourceClass={Endpoints}
2020
filterFunction={filterFunc}
2121
columns={[
2222
'name',
2323
'namespace',
2424
{
25-
label: t('Addresses'),
25+
label: t('frequent|Addresses'),
2626
getter: endpoint => endpoint.getAddressesText(),
2727
cellProps: { style: { width: '40%', maxWidth: '40%' } },
2828
},

frontend/src/components/horizontalPodAutoscaler/Details.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ export default function HpaDetails() {
4444
},
4545
{
4646
name: t('hpa|Deployment pods'),
47-
value: `${item.status.currentReplicas} current / ${item.status.desiredReplicas} desired`,
47+
value: t(`hpa|{{ currentReplicas }} current / {{ desiredReplicas }} desired`, {
48+
currentReplicas: item.status.currentReplicas,
49+
desiredReplicas: item.status.desiredReplicas,
50+
}),
4851
},
4952
]
5053
}

frontend/src/components/horizontalPodAutoscaler/List.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function HpaList() {
4040
if (hpa.metrics.length > 1) {
4141
value.push(
4242
<StatusLabel key="more..." status="">
43-
{metrics.length - 1} {t('frequent|more...')}
43+
{metrics.length - 1} {t('frequent|more')}
4444
</StatusLabel>
4545
);
4646
}

frontend/src/components/podDisruptionBudget/Details.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function PDBDetails() {
2020
return values;
2121
}
2222

23-
const { t } = useTranslation(['pdb', 'frequent']);
23+
const { t } = useTranslation(['pdb', 'frequent', 'glossary']);
2424
return (
2525
<DetailsGrid
2626
resourceType={PDB}
@@ -29,7 +29,7 @@ export default function PDBDetails() {
2929
extraInfo={item =>
3030
item && [
3131
{
32-
name: t('pdb|Selector'),
32+
name: t('glossary|Selector'),
3333
value: <>{selectorsToJSX(item.selectors)}</>,
3434
},
3535
{

frontend/src/components/priorityClass/Details.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function PriorityClassDetails() {
2626
value: item.preemptionPolicy,
2727
},
2828
{
29-
name: t('priorityClasses|Description'),
29+
name: t('frequent|Description'),
3030
value: item.description,
3131
},
3232
]

frontend/src/components/resourceQuota/Details.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { DetailsGrid, SimpleTable } from '../common';
55

66
export default function ResourceQuotaDetails() {
77
const { namespace, name } = useParams<{ namespace: string; name: string }>();
8-
const { t } = useTranslation(['frequent', 'resourceQuota']);
8+
const { t } = useTranslation(['frequent', 'glossary', 'resourceQuota']);
99

1010
return (
1111
<DetailsGrid
@@ -21,7 +21,7 @@ export default function ResourceQuotaDetails() {
2121
data={item.resourceStats}
2222
columns={[
2323
{
24-
label: t('resourceQuota|Resource'),
24+
label: t('glossary|Resource'),
2525
getter: item => item.name,
2626
},
2727
{

frontend/src/components/resourceQuota/List.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { SectionBox, SectionFilterHeader, StatusLabel } from '../common';
44
import ResourceTable from '../common/Resource/ResourceTable';
55

66
export default function ResourceQuotaList() {
7-
const { t } = useTranslation(['resourceQuota', 'glossary']);
7+
const { t } = useTranslation(['frequent', 'glossary']);
88
return (
99
<SectionBox title={<SectionFilterHeader title={t('glossary|Resource Quotas')} />}>
1010
<ResourceTable
@@ -13,7 +13,7 @@ export default function ResourceQuotaList() {
1313
'name',
1414
'namespace',
1515
{
16-
label: t('resourceQuota|Request'),
16+
label: t('frequent|Request'),
1717
getter: (item: ResourceQuota) => {
1818
const requests: JSX.Element[] = [];
1919
item.requests.forEach((request: string) => {
@@ -23,7 +23,7 @@ export default function ResourceQuotaList() {
2323
},
2424
},
2525
{
26-
label: t('resourceQuota|Limit'),
26+
label: t('frequent|Limit'),
2727
getter: (item: ResourceQuota) => {
2828
const limits: JSX.Element[] = [];
2929
item.limits.forEach((limit: string) => {

frontend/src/components/service/Details.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import SimpleTable from '../common/SimpleTable';
1515

1616
export default function ServiceDetails() {
1717
const { namespace, name } = useParams<{ namespace: string; name: string }>();
18-
const { t } = useTranslation('glossary');
18+
const { t } = useTranslation(['glossary', 'frequent']);
1919

2020
const [endpoints, endpointsError] = Endpoints.useList({ namespace });
2121

@@ -87,11 +87,11 @@ export default function ServiceDetails() {
8787
data={getOwnedEndpoints(item)}
8888
columns={[
8989
{
90-
label: t('Name'),
90+
label: t('frequent|Name'),
9191
getter: endpoint => <Link kubeObject={endpoint} />,
9292
},
9393
{
94-
label: t('Addresses'),
94+
label: t('frequent|Addresses'),
9595
getter: endpoint => endpoint.getAddressesText(),
9696
cellProps: { style: { width: '40%', maxWidth: '40%' } },
9797
},

frontend/src/i18n/locales/en/cluster.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
"{{ available }} units": "{{ available }} units",
44
"CPU Usage": "CPU Usage",
55
"{{ numReady }} / {{ numItems }} Requested": "{{ numReady }} / {{ numItems }} Requested",
6-
"Cluster: {{cluster}}": "Cluster: {{cluster}}",
76
"Recent clusters": "Recent clusters",
87
"All clusters": "All clusters",
8+
"Show build information": "Show build information",
99
"Choose a cluster": "Choose a cluster",
1010
"Wait while fetching clusters…": "Wait while fetching clusters…",
1111
"Loading cluster information": "Loading cluster information",
1212
"There seems to be no clusters configured…": "There seems to be no clusters configured…",
1313
"Please make sure you have at least one cluster configured.": "Please make sure you have at least one cluster configured.",
1414
"Or try running Headlamp with a different kube config.": "Or try running Headlamp with a different kube config.",
15+
"Cluster: {{cluster}}": "Cluster: {{cluster}}",
1516
"Install the metrics-server to get usage data.": "Install the metrics-server to get usage data.",
1617
"Cluster version upgraded to {{ gitVersion }}": "Cluster version upgraded to {{ gitVersion }}",
1718
"Cluster version downgraded to {{ gitVersion }}": "Cluster version downgraded to {{ gitVersion }}"

frontend/src/i18n/locales/en/crd.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
2-
"Error getting custom resource definition {{ crName }}: {{ errorMessage }}": "Error getting custom resource definition {{ crName }}: {{ errorMessage }}",
2+
"Error getting custom resource definition {{ crdName }}: {{ errorMessage }}": "Error getting custom resource definition {{ crdName }}: {{ errorMessage }}",
33
"Loading custom resource details": "Loading custom resource details",
44
"Error getting custom resource {{ crName }}: {{ errorMessage }}": "Error getting custom resource {{ crName }}: {{ errorMessage }}",
5-
"Failed to get objects": "Failed to get objects",
65
"Accepted Names": "Accepted Names",
76
"Custom Resource Definitions": "Custom Resource Definitions"
87
}

0 commit comments

Comments
 (0)