Skip to content

Commit

Permalink
translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Doppen committed Jun 20, 2024
1 parent b21703c commit 313d230
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/researcher/src/app/[locale]/objects/settings-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function SettingsMenu() {
className="rounded p-2 text-sm border bg-neutral-100 pr-6"
onChange={e => limitChange(parseInt(e.target.value))}
value={limit}
aria-label={t('resultLimitAria')}
aria-label={t('accessibilityResultLimit')}
>
<option value="10">10</option>
<option value="25">25</option>
Expand Down
8 changes: 6 additions & 2 deletions apps/researcher/src/messages/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"list": "List",
"listAria": "Set the amount of results",
"resultLimit": "Number of results",
"resultLimitAria": "Set the number of results",
"accessibilityResultLimit": "Set the number of results",
"images": "Images",
"imagesDescription": "You can decrease the amount of data that this site is using. You can change this setting in the <em>View settings</em> on the result page.",
"noImages": "No images",
Expand Down Expand Up @@ -296,7 +296,11 @@
"orderByCount": "Order by count",
"selectedFilters": "Selected filters",
"aboutFacetsHeader": "About these facets",
"aboutFacetsText": "The data of these facet items are collected from multiple datasets. We are in the process of improving the quality of these facets items.\n\nPlease note that currently, for some facets the items for search filters are provided in Dutch, regardless of the selected interface language. We're working on adding translations soon."
"aboutFacetsText": "The data of these facet items are collected from multiple datasets. We are in the process of improving the quality of these facets items.\n\nPlease note that currently, for some facets the items for search filters are provided in Dutch, regardless of the selected interface language. We're working on adding translations soon.",
"accessibilityFacetLabel": "filter {title} on with {name}",
"accessibilityFacetCount": "{count} results",
"accessibilityInitLetter": "Filter within the filter items with initial letter {category}",
"facetJumpToResults": "Jump to results"
},
"Sort": {
"dateCreatedDesc": "Date made - Descending",
Expand Down
9 changes: 6 additions & 3 deletions apps/researcher/src/messages/nl/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"list": "Lijst",
"listAria": "Bekijk resultaten in een lijst",
"resultLimit": "Aantal resultaten",
"resultLimitAria": "Bewerk het aantal resultaten",
"accessibilityResultLimit": "Bewerk het aantal resultaten",
"images": "Afbeeldingen",
"imagesDescription": "U kunt de hoeveelheid gegevens die deze site gebruikt verminderen. U kunt deze instelling wijzigen in de <em>Weergave-instellingen</em> op de resultatenpagina.",
"noImages": "Geen afbeeldingen",
Expand Down Expand Up @@ -286,7 +286,6 @@
"tillYear": "Tot en met jaar",
"expandFilter": "Meer",
"expandFilterAria": "klik voor meer items om op te filteren",
"expandFilterInitLetter": "Meer",
"clearAllFilters": "Zoekfilters verwijderen",
"filterSearchPlaceholder": "Filteren op {filterName}",
"accessibilityTypeToFilter": "Typ om op tekst te filteren",
Expand All @@ -297,7 +296,11 @@
"orderByCount": "Sorteer op aantal",
"selectedFilters": "Geselecteerde filters",
"aboutFacetsHeader": "Over de facetten",
"aboutFacetsText": "De gegevens van deze facetten worden verzameld uit meerdere datasets. We zijn bezig de kwaliteit van deze facetten te verbeteren."
"aboutFacetsText": "De gegevens van deze facetten worden verzameld uit meerdere datasets. We zijn bezig de kwaliteit van deze facetten te verbeteren.",
"accessibilityFacetLabel": "filter op {title} met {name}",
"accessibilityFacetCount": "{count} resultaten",
"accessibilityInitLetter": "Filter binnen de filteritems op beginletter {category}",
"facetJumpToResults": "Ga naar de resultaten"
},
"Sort": {
"dateCreatedDesc": "Datum gemaakt - Aflopend",
Expand Down
12 changes: 9 additions & 3 deletions packages/ui/list/base-facet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
useContext,
} from 'react';
import {useListStore} from '@colonial-collections/list-store';
import {useTranslations} from 'next-intl';

interface FacetContextProps {
title: string;
Expand All @@ -29,6 +30,7 @@ export function FacetWrapper({children, testId, title}: FacetWrapperProps) {
const context = {
title,
};
const t = useTranslations('Filters');

return (
<FacetContext.Provider value={context}>
Expand All @@ -38,7 +40,7 @@ export function FacetWrapper({children, testId, title}: FacetWrapperProps) {
</div>
</fieldset>
<div className="sr-only">
<a href="#search-results">Jump to results</a>
<a href="#search-results">{t('facetJumpToResults')}</a>
</div>
</FacetContext.Provider>
);
Expand Down Expand Up @@ -68,6 +70,7 @@ export function FacetCheckBox({
const newDataNeeded = useListStore(s => s.newDataNeeded);
const [isMounted, setIsMounted] = useState(false);
const {title} = useContext(FacetContext);
const t = useTranslations('Filters');

// Wait for hydration to complete before enabling the input
useEffect(() => {
Expand Down Expand Up @@ -111,12 +114,15 @@ export function FacetCheckBox({
/>
<div
className="truncate max-w-[230px]"
aria-label={`filter ${title} on with ${name}`}
aria-label={t('accessibilityFacetLabel', {title, name})}
>
{name}
</div>
</div>
<div className="text-sm text-neutral-600" aria-label={`${count} results`}>
<div
className="text-sm text-neutral-600"
aria-label={t('accessibilityFacetCount', {count})}
>
{count}
</div>
</label>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/list/searchable-multi-select-facet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function ExpandedFacet({filterKey}: ExpandedFacetProps) {
? 'px-1 bg-black text-white rounded'
: ''
}
aria-label={`Filter within the filter items with initial letter ${category}`}
aria-label={t('accessibilityInitLetter', {category})}
>
{category}
</button>
Expand Down

0 comments on commit 313d230

Please sign in to comment.