mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +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
|
|
@ -3,7 +3,7 @@ import type { MouseEvent, FocusEvent, KeyboardEvent } from 'react';
|
|||
import { useArchiveConversationMutation } from '~/data-provider';
|
||||
import { NotificationSeverity } from '~/common';
|
||||
import { useToastContext } from '~/Providers';
|
||||
import useLocalize from '../useLocalize';
|
||||
import useLocalize, { TranslationKeys } from '../useLocalize';
|
||||
import useNewConvo from '../useNewConvo';
|
||||
|
||||
export default function useArchiveHandler(
|
||||
|
|
@ -27,7 +27,7 @@ export default function useArchiveHandler(
|
|||
if (!convoId) {
|
||||
return;
|
||||
}
|
||||
const label = shouldArchive ? 'archive' : 'unarchive';
|
||||
const label: TranslationKeys = shouldArchive ? 'com_ui_archive_error' : 'com_ui_unarchive_error';
|
||||
archiveConvoMutation.mutate(
|
||||
{ conversationId: convoId, isArchived: shouldArchive },
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ export default function useArchiveHandler(
|
|||
},
|
||||
onError: () => {
|
||||
showToast({
|
||||
message: localize(`com_ui_${label}_error`),
|
||||
message: localize(label),
|
||||
severity: NotificationSeverity.ERROR,
|
||||
showIcon: true,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ const useFileHandling = (params?: UseFileHandling) => {
|
|||
|
||||
const displayToast = useCallback(() => {
|
||||
if (errors.length > 1) {
|
||||
// TODO: this should not be a dynamic localize input!!
|
||||
const errorList = Array.from(new Set(errors))
|
||||
.map((e, i) => `${i > 0 ? '• ' : ''}${localize(e) || e}\n`)
|
||||
.join('');
|
||||
|
|
@ -78,6 +79,7 @@ const useFileHandling = (params?: UseFileHandling) => {
|
|||
duration: 5000,
|
||||
});
|
||||
} else if (errors.length === 1) {
|
||||
// TODO: this should not be a dynamic localize input!!
|
||||
const message = localize(errors[0]) || errors[0];
|
||||
showToast({
|
||||
message,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue