Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Fix translations for i18n bump to v23 #64

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"README.md"
],
"dependencies": {
"@types/history": "^4.7.11",
"json-e": "^4.4.3",
"lodash": "^4.17.21",
"qs": "^6.10.3",
Expand All @@ -25,6 +24,7 @@
"devDependencies": {
"@balena/lint": "^6.2.0",
"@types/enzyme": "^3.10.12",
"@types/history": "^4.7.11",
"@types/jest": "^26.0.24",
"@types/jsdom": "^20.0.0",
"@types/lodash": "^4.14.185",
Expand Down
2 changes: 1 addition & 1 deletion src/AutoUI/NoRecordsFoundView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const NoRecordsFoundView = <T extends AutoUIBaseResource<T>>({
<Heading.h2 bold my="3">
{noDataInfo?.title ??
t('no_data.no_resource_data_title', {
resource: t(`resource.${model.resource}_plural`).toLowerCase(),
resource: t(`resource.${model.resource}_other`).toLowerCase(),
})}
</Heading.h2>
{noDataInfo?.subtitle && (
Expand Down
4 changes: 2 additions & 2 deletions src/AutoUI/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export const AutoUI = <T extends AutoUIBaseResource<T>>({
label={
isBusyMessage ??
t('loading.resource', {
resource: t(`resource.${model.resource}_plural`).toLowerCase(),
resource: t(`resource.${model.resource}_other`).toLowerCase(),
})
}
show={data == null || loading || !!isBusyMessage}
Expand Down Expand Up @@ -503,7 +503,7 @@ export const AutoUI = <T extends AutoUIBaseResource<T>>({
) : (
t('no_data.no_resource_data', {
resource: t(
`resource.${model.resource}_plural`,
`resource.${model.resource}_other`,
).toLowerCase(),
})
))
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useTranslation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const translationMap = {
'no_data.no_resource_data_description':
"This is a bit empty right now, let's go ahead and add one",
'questions.how_about_adding_one': 'How about adding one?',
'resource.item_plural': 'Items',
'resource.item_other': 'Items',
'success.resource_added_successfully': '{{name}} added successfully',
};

Expand All @@ -39,7 +39,7 @@ const getTranslation = (
return translation;
}
if (opts.count != null && opts.count > 1) {
const pluralKey = `${str}_plural` as keyof typeof translationMap;
const pluralKey = `${str}_other` as keyof typeof translationMap;
translation =
translationMap[pluralKey] ??
translationMap[str as keyof typeof translationMap];
Expand Down
Loading