Skip to content

Commit

Permalink
Added translations
Browse files Browse the repository at this point in the history
  • Loading branch information
SanjeevLakhwani committed Nov 21, 2024
1 parent 89057f3 commit a13a864
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
17 changes: 10 additions & 7 deletions src/js/components/Provenance/Catalogue/CatalogueCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ import { Card, Carousel, Descriptions, Flex, Space, Tag, Typography } from 'antd
import CatalogueCarouselDataset from '@/components/Provenance/Catalogue/CatalogueCarouselDataset';
import type { Project } from '@/types/metadata';
import { isoDateToString } from '@/utils/strings';
import { useTranslationFn } from '@/hooks';

const { Paragraph } = Typography;

const MAX_CHARACTERS = 50;

const CatalogueCard = ({ project }: { project: Project }) => {
const t = useTranslationFn();

const keywords = project.datasets
.map((d) => d.dats_file.keywords ?? [])
.flat()
.map((k) => k.value as string);
.map((k) => t(k.value as string));

let totalCharacters = 0;
const selectedKeywords = [];
Expand All @@ -29,7 +32,7 @@ const CatalogueCard = ({ project }: { project: Project }) => {
const projectInfo = [
{
key: '1',
label: 'Created',
label: t('Created'),
children: (
<Paragraph
ellipsis={{
Expand All @@ -44,7 +47,7 @@ const CatalogueCard = ({ project }: { project: Project }) => {
},
{
key: '2',
label: 'Updated',
label: t('Updated'),
children: (
<Paragraph ellipsis={{ rows: 1, tooltip: { title: isoDateToString(project.updated) } }}>
{isoDateToString(project.updated)}
Expand All @@ -60,15 +63,15 @@ const CatalogueCard = ({ project }: { project: Project }) => {
<div style={{ width: '50%', paddingRight: '10px' }}>
<Space direction="vertical">
<Typography.Title level={5} style={{ marginTop: 0 }}>
{project.title}
{t(project.title)}
</Typography.Title>
<Typography.Paragraph
ellipsis={{
rows: 3,
tooltip: { title: project.description },
tooltip: { title: t(project.description) },
}}
>
{project.description}
{t(project.description)}
</Typography.Paragraph>
<div>
{selectedKeywords.map((kw) => (
Expand All @@ -83,7 +86,7 @@ const CatalogueCard = ({ project }: { project: Project }) => {
</div>
<div style={{ width: '50%', maxWidth: '600px' }}>
<Typography.Title level={4} style={{ marginTop: 0 }}>
Datasets
{t('Datasets')}
</Typography.Title>
<Carousel arrows style={{ border: '1px solid lightgray', borderRadius: '7px' }}>
{project.datasets.map((d) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { Card, Typography } from 'antd';
import type { Dataset } from '@/types/metadata';
import { useTranslationFn } from '@/hooks';

const CatalogueCarouselDataset = ({ dataset }: { dataset: Dataset }) => {
const t = useTranslationFn();
return (
<Card style={{ height: '180px' }}>
<Typography.Title level={5} style={{ marginTop: 0 }}>
{dataset.title}
{t(dataset.title)}
</Typography.Title>
<Typography.Paragraph ellipsis={{ rows: 4, tooltip: { title: dataset.description } }}>
{dataset.description}
{t(dataset.description)}
</Typography.Paragraph>
</Card>
);
Expand Down
4 changes: 3 additions & 1 deletion src/public/locales/en/default_translation_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,7 @@
"show_all_filters": "show all filters",
"common_filters_only": "common filters only",
"home_page": "Home Page"
}
},
"Created": "Created",
"Updated": "Updated"
}
4 changes: 3 additions & 1 deletion src/public/locales/fr/default_translation_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,7 @@
"show_all_filters": "afficher tous les filtres",
"common_filters_only": "filtres communs uniquement",
"home_page": "Page d'accueil"
}
},
"Created": "Créé",
"Updated": "Mis à jour"
}

0 comments on commit a13a864

Please sign in to comment.