Skip to content

Commit

Permalink
feat: Add translations to storage page
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroWave022 committed Aug 22, 2024
1 parent 0843c07 commit 104dfc4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 24 deletions.
10 changes: 9 additions & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
"views": "Views"
},
"storage": {
"title": "Storage"
"title": "Storage",
"combobox": {
"popularity": "Popularity",
"sortDescending": "Inventory (descending)",
"sortAscending": "Inventory (ascending)",
"name": "Name (in alphabetical order)",
"defaultDescription": "Choose sorting...",
"defaultPlaceholder": "Search filters..."
}
}
}
10 changes: 9 additions & 1 deletion messages/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
"views": "Visninger"
},
"storage": {
"title": "Lager"
"title": "Lager",
"combobox": {
"popularity": "Popularitet",
"sortDescending": "Lagerbeholdning (synkende)",
"sortAscending": "Lagerbeholdning (stigende)",
"name": "Navn (alfabetisk)",
"defaultDescription": "Velg sortering...",
"defaultPlaceholder": "Søk etter filtere..."
}
}
}
46 changes: 24 additions & 22 deletions src/app/[locale]/(default)/storage/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useTranslations } from 'next-intl';
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';

import { Combobox } from '@/components/ui/Combobox';
Expand All @@ -15,39 +16,40 @@ export async function generateMetadata({
};
}

const categories = [
{
value: 'popularity',
label: 'Popularitet',
},
{
value: 'sortDescending',
label: 'Lagerbeholdning (Synkende)',
},
{
value: 'sortAscending',
label: 'Lagerbeholdning (Stigende)',
},
{
value: 'name',
label: 'Navn (alfabetisk)',
},
];

export default function StoragePage({
params: { locale },
}: {
params: { locale: string };
}) {
unstable_setRequestLocale(locale);
const t = useTranslations('storage');

const categories = [
{
value: 'popularity',
label: t('combobox.popularity'),
},
{
value: 'sortDescending',
label: t('combobox.sortDescending'),
},
{
value: 'sortAscending',
label: t('combobox.sortAscending'),
},
{
value: 'name',
label: t('combobox.name'),
},
];
return (
<>
<h1>Storage</h1>
<h1>{t('title')}</h1>
<SearchBar />
<Combobox
choices={categories}
defaultDescription='Velg sortering...'
defaultPlaceholder='Søk etter filtere...'
defaultDescription={t('combobox.defaultDescription')}
defaultPlaceholder={t('combobox.defaultPlaceholder')}
/>
</>
);
Expand Down

0 comments on commit 104dfc4

Please sign in to comment.