From d7a6fceb30e46a69b94e9e0b6a72bdbf53fc1e16 Mon Sep 17 00:00:00 2001 From: Victor Nogueira Date: Tue, 14 May 2024 17:48:36 -0300 Subject: [PATCH] feat(i18n): use dictionary in batches --- .../app/batches/[id]/batch-upload-list.tsx | 28 +++++++++---------- .../app/[locale]/app/batches/[id]/page.tsx | 12 +++++--- packages/i18n/dictionaries/en.json | 14 +++++++++- packages/i18n/dictionaries/pt.json | 14 +++++++++- 4 files changed, 47 insertions(+), 21 deletions(-) diff --git a/apps/web/src/app/[locale]/app/batches/[id]/batch-upload-list.tsx b/apps/web/src/app/[locale]/app/batches/[id]/batch-upload-list.tsx index 3c50d94..0c88393 100644 --- a/apps/web/src/app/[locale]/app/batches/[id]/batch-upload-list.tsx +++ b/apps/web/src/app/[locale]/app/batches/[id]/batch-upload-list.tsx @@ -5,6 +5,7 @@ import { SymbolIcon } from '@radix-ui/react-icons' import { Cable, CopyIcon, Loader2, ReceiptText } from 'lucide-react' import Image from 'next/image' import Link from 'next/link' +import { useDictionary } from '@/state/dictionary' import { CopyButton } from '@/components/copy-button' import { TranscriptionPreview } from '@/components/transcription-preview' @@ -33,6 +34,7 @@ export interface BatchUploadListProps { } export function BatchUploadList({ batchId }: BatchUploadListProps) { + const dictionary = useDictionary() const { data, isLoading: isLoadingBatch, @@ -57,24 +59,24 @@ export function BatchUploadList({ batchId }: BatchUploadListProps) {
- Video + {dictionary.batch_upload_list_video_column} {isRefetchingBatch && ( )}
- Duration - Size + {dictionary.batch_upload_list_duration_column} + {dictionary.batch_upload_list_size_column}
- Transcription + {dictionary.batch_upload_list_transcription_column}
- External ID + {dictionary.batch_upload_list_external_id_column}
@@ -121,9 +123,7 @@ export function BatchUploadList({ batchId }: BatchUploadListProps) { ) : (
- - Processing - + {dictionary.batch_upload_list_processing_status}
)} @@ -139,15 +139,13 @@ export function BatchUploadList({ batchId }: BatchUploadListProps) { textToCopy={video.externalProviderId} > - Copy + {dictionary.batch_upload_list_copy_button} ) : (
- - Processing - + {dictionary.batch_upload_list_processing_status}
)} @@ -159,7 +157,7 @@ export function BatchUploadList({ batchId }: BatchUploadListProps) { {video.author?.image && (
- by + {dictionary.batch_upload_list_by} - + )) ) : ( - No results. + {dictionary.batch_upload_list_no_results} )} diff --git a/apps/web/src/app/[locale]/app/batches/[id]/page.tsx b/apps/web/src/app/[locale]/app/batches/[id]/page.tsx index 78a72c4..cedfb16 100644 --- a/apps/web/src/app/[locale]/app/batches/[id]/page.tsx +++ b/apps/web/src/app/[locale]/app/batches/[id]/page.tsx @@ -1,30 +1,34 @@ import { Metadata } from 'next' import { BatchUploadList } from './batch-upload-list' +import { Locale, getDictionary } from '@nivo/i18n' interface BatchPageProps { - params: { id: string } + params: { id: string, locale: Locale } } export async function generateMetadata({ params, }: BatchPageProps): Promise { + const dictionary = await getDictionary(params.locale) const id = params.id return { - title: `Batch ${id}`, + title: `${dictionary.batch_page_generate_metadata_title} ${id}`, } } export default async function BatchPage({ params }: BatchPageProps) { + const dictionary = await getDictionary(params.locale) + return ( <>
-

Batch details

+

{dictionary.batch_page_header_title}

- This page refreshes every 15s + {dictionary.batch_page_refresh_notice}
diff --git a/packages/i18n/dictionaries/en.json b/packages/i18n/dictionaries/en.json index f82d23c..9f3f916 100644 --- a/packages/i18n/dictionaries/en.json +++ b/packages/i18n/dictionaries/en.json @@ -258,5 +258,17 @@ "uploads_pagination_go_to_first_page": "Go to first page", "uploads_pagination_go_to_previous_page": "Go to previous page", "uploads_pagination_go_to_next_page": "Go to next page", - "uploads_pagination_go_to_last_page": "Go to last page" + "uploads_pagination_go_to_last_page": "Go to last page", + "batch_upload_list_video_column": "Video", + "batch_upload_list_duration_column": "Duration", + "batch_upload_list_size_column": "Size", + "batch_upload_list_transcription_column": "Transcription", + "batch_upload_list_external_id_column": "External ID", + "batch_upload_list_processing_status": "Processing", + "batch_upload_list_copy_button": "Copy", + "batch_upload_list_by": "by", + "batch_upload_list_no_results": "No results.", + "batch_page_header_title": "Batch details", + "batch_page_refresh_notice": "This page refreshes every 15s", + "batch_page_generate_metadata_title": "Batch" } diff --git a/packages/i18n/dictionaries/pt.json b/packages/i18n/dictionaries/pt.json index 6255392..7a3e3d8 100644 --- a/packages/i18n/dictionaries/pt.json +++ b/packages/i18n/dictionaries/pt.json @@ -252,5 +252,17 @@ "uploads_pagination_go_to_first_page": "Ir para a primeira página", "uploads_pagination_go_to_previous_page": "Ir para a página anterior", "uploads_pagination_go_to_next_page": "Ir para a próxima página", - "uploads_pagination_go_to_last_page": "Ir para a última página" + "uploads_pagination_go_to_last_page": "Ir para a última página", + "batch_upload_list_video_column": "Vídeo", + "batch_upload_list_duration_column": "Duração", + "batch_upload_list_size_column": "Tamanho", + "batch_upload_list_transcription_column": "Transcrição", + "batch_upload_list_external_id_column": "ID Externo", + "batch_upload_list_processing_status": "Processando", + "batch_upload_list_copy_button": "Copiar", + "batch_upload_list_by": "por", + "batch_upload_list_no_results": "Sem resultados.", + "batch_page_header_title": "Detalhes do Lote", + "batch_page_refresh_notice": "Esta página é atualizada a cada 15s", + "batch_page_generate_metadata_title": "Lote" }