mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-16 15:35:31 +01:00
🔄 chore: Enforce 18next Language Keys (#5803)
* chore: enforcing language keys to adhere to the new standard. * chore: enforcing i18n forbids to write plain text in JSX markup * chore: enforcing i18n forbids to write plain text in JSX markup * fix: ci with checkbox for unused keys :) * refactor: removed all the unused `i18n` keys
This commit is contained in:
parent
2a506df443
commit
7f48030452
33 changed files with 200 additions and 219 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
|
||||
import { ArrowUpDown, Database } from 'lucide-react';
|
||||
import { FileSources, FileContext } from 'librechat-data-provider';
|
||||
import type { ColumnDef } from '@tanstack/react-table';
|
||||
|
|
@ -7,10 +7,10 @@ import { Button, Checkbox, OpenAIMinimalIcon, AzureMinimalIcon } from '~/compone
|
|||
import ImagePreview from '~/components/Chat/Input/Files/ImagePreview';
|
||||
import FilePreview from '~/components/Chat/Input/Files/FilePreview';
|
||||
import { SortFilterHeader } from './SortFilterHeader';
|
||||
import { useLocalize, useMediaQuery } from '~/hooks';
|
||||
import { TranslationKeys, useLocalize, useMediaQuery } from '~/hooks';
|
||||
import { formatDate, getFileType } from '~/utils';
|
||||
|
||||
const contextMap = {
|
||||
const contextMap: Record<any, TranslationKeys> = {
|
||||
[FileContext.avatar]: 'com_ui_avatar',
|
||||
[FileContext.unknown]: 'com_ui_unknown',
|
||||
[FileContext.assistants]: 'com_ui_assistants',
|
||||
|
|
@ -127,8 +127,8 @@ export const columns: ColumnDef<TFile>[] = [
|
|||
),
|
||||
}}
|
||||
valueMap={{
|
||||
[FileSources.azure]: 'Azure',
|
||||
[FileSources.openai]: 'OpenAI',
|
||||
[FileSources.azure]: 'com_ui_azure',
|
||||
[FileSources.openai]: 'com_ui_openai',
|
||||
[FileSources.local]: 'com_ui_host',
|
||||
}}
|
||||
/>
|
||||
|
|
@ -182,7 +182,7 @@ export const columns: ColumnDef<TFile>[] = [
|
|||
const localize = useLocalize();
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{localize(contextMap[context ?? FileContext.unknown] ?? 'com_ui_unknown')}
|
||||
{localize(contextMap[context ?? FileContext.unknown])}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
|
@ -212,4 +212,4 @@ export const columns: ColumnDef<TFile>[] = [
|
|||
return `${value}${suffix}`;
|
||||
},
|
||||
},
|
||||
];
|
||||
];
|
||||
|
|
@ -16,7 +16,7 @@ interface SortFilterHeaderProps<TData, TValue> extends React.HTMLAttributes<HTML
|
|||
title: string;
|
||||
column: Column<TData, TValue>;
|
||||
filters?: Record<string, string[] | number[]>;
|
||||
valueMap?: Record<string, string>;
|
||||
valueMap?: Record<any, TranslationKeys>;
|
||||
}
|
||||
|
||||
export function SortFilterHeader<TData, TValue>({
|
||||
|
|
@ -82,7 +82,7 @@ export function SortFilterHeader<TData, TValue>({
|
|||
const translationKey = valueMap?.[value ?? ''];
|
||||
const filterValue =
|
||||
translationKey != null && translationKey.length
|
||||
? localize(translationKey as TranslationKeys)
|
||||
? localize(translationKey)
|
||||
: String(value);
|
||||
if (!filterValue) {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue