toast if exists

This commit is contained in:
CJ Pais 2026-02-19 17:26:14 +08:00
parent 2cf5effef3
commit e624a45264
18 changed files with 44 additions and 19 deletions

View file

@ -1,5 +1,6 @@
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import { useSettings } from "../../hooks/useSettings";
import { Input } from "../ui/Input";
import { Button } from "../ui/Button";
@ -23,9 +24,16 @@ export const CustomWords: React.FC<CustomWordsProps> = React.memo(
if (
sanitizedWord &&
!sanitizedWord.includes(" ") &&
sanitizedWord.length <= 50 &&
!customWords.includes(sanitizedWord)
sanitizedWord.length <= 50
) {
if (customWords.includes(sanitizedWord)) {
toast.error(
t("settings.advanced.customWords.duplicate", {
word: sanitizedWord,
}),
);
return;
}
updateSetting("custom_words", [...customWords, sanitizedWord]);
setNewWord("");
}

View file

@ -294,7 +294,8 @@
"description": ".أضف الكلمات التي غالباً ما يتم فهمها بشكل خاطئ أو كتابتها بشكل خاطئ أثناء التفريغ. سيقوم النظام تلقائياً بتصحيح الكلمات ذات الصوت المماثل لتطابق قائمتك",
"placeholder": "أضف كلمة",
"add": "إضافة",
"remove": "إزالة {{word}}"
"remove": "إزالة {{word}}",
"duplicate": "\"{{word}}\" موجود بالفعل"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Přidejte slova, která jsou při přepisu často špatně rozpoznána nebo napsána. Systém automaticky opraví podobně znějící slova podle vašeho seznamu.",
"placeholder": "Přidat slovo",
"add": "Přidat",
"remove": "Odebrat {{word}}"
"remove": "Odebrat {{word}}",
"duplicate": "\"{{word}}\" již existuje"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Wörter hinzufügen, die oft falsch gehört oder geschrieben werden. Das System korrigiert automatisch ähnlich klingende Wörter entsprechend deiner Liste.",
"placeholder": "Wort hinzufügen",
"add": "Hinzufügen",
"remove": "{{word}} entfernen"
"remove": "{{word}} entfernen",
"duplicate": "\"{{word}}\" existiert bereits"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Add words that are often misheard or misspelled during transcription. The system will automatically correct similar-sounding words to match your list.",
"placeholder": "Add a word",
"add": "Add",
"remove": "Remove {{word}}"
"remove": "Remove {{word}}",
"duplicate": "\"{{word}}\" already exists"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Agrega palabras que a menudo se escuchan mal o se escriben incorrectamente durante la transcripción. El sistema corregirá automáticamente palabras similares para que coincidan con tu lista.",
"placeholder": "Agregar una palabra",
"add": "Agregar",
"remove": "Eliminar {{word}}"
"remove": "Eliminar {{word}}",
"duplicate": "\"{{word}}\" ya existe"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Ajoutez des mots souvent mal entendus ou mal orthographiés lors de la transcription. Le système corrigera automatiquement les mots similaires pour correspondre à votre liste.",
"placeholder": "Ajouter un mot",
"add": "Ajouter",
"remove": "Supprimer {{word}}"
"remove": "Supprimer {{word}}",
"duplicate": "\"{{word}}\" existe déjà"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Aggiungi parole che vengono spesso fraintese o scritte in modo errato durante la trascrizione. Il sistema correggerà automaticamente le parole dal suono simile in modo che corrispondano al tuo elenco.",
"placeholder": "Aggiungi una parola",
"add": "Aggiungi",
"remove": "Rimuovi {{word}}"
"remove": "Rimuovi {{word}}",
"duplicate": "\"{{word}}\" esiste già"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "よく誤認識または誤入力される単語を追加します。システムは自動的に類似した発音の単語をリストに合わせて修正します。",
"placeholder": "単語を追加",
"add": "追加",
"remove": "{{word}}を削除"
"remove": "{{word}}を削除",
"duplicate": "「{{word}}」は既に存在します"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "녹음 중 자주 잘못 들리거나 철자가 틀리는 단어를 추가하세요. 시스템이 유사한 소리의 단어를 목록과 일치하도록 자동으로 수정합니다.",
"placeholder": "단어 추가",
"add": "추가",
"remove": "{{word}} 제거"
"remove": "{{word}} 제거",
"duplicate": "\"{{word}}\"이(가) 이미 존재합니다"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Dodaj słowa, które często są źle rozpoznawane lub zapisywane podczas transkrypcji. System automatycznie poprawi podobnie brzmiące słowa, aby pasowały do Twojej listy.",
"placeholder": "Dodaj słowo",
"add": "Dodaj",
"remove": "Usuń {{word}}"
"remove": "Usuń {{word}}",
"duplicate": "\"{{word}}\" już istnieje"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Adicione palavras que são frequentemente mal ouvidas ou mal escritas durante a transcrição. O sistema irá automaticamente corrigir palavras semelhantes para corresponder à sua lista.",
"placeholder": "Adicionar uma palavra",
"add": "Adicionar",
"remove": "Remover {{word}}"
"remove": "Remover {{word}}",
"duplicate": "\"{{word}}\" já existe"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Добавить слова, которые часто неправильно слышатся или пишутся с ошибками во время транскрипции. Система автоматически исправит похожие по звучанию слова, чтобы они соответствовали вашему списку.",
"placeholder": "Добавить слово",
"add": "Добавлять",
"remove": "Удалить {{word}}"
"remove": "Удалить {{word}}",
"duplicate": "\"{{word}}\" уже существует"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Transkripsiyon sırasında sıkça yanlış duyulan veya yanlış yazılan kelimeleri ekleyin. Sistem, benzer sesli kelimeleri listenize göre otomatik olarak düzeltir.",
"placeholder": "Kelime ekle",
"add": "Ekle",
"remove": "{{word}} Kaldır"
"remove": "{{word}} Kaldır",
"duplicate": "\"{{word}}\" zaten mevcut"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Додайте слова, які часто неправильно розпізнаються під час транскрипції. Система автоматично виправлятиме схожі за звучанням слова відповідно до вашого списку.",
"placeholder": "Додати слово",
"add": "Додати",
"remove": "Видалити {{word}}"
"remove": "Видалити {{word}}",
"duplicate": "\"{{word}}\" вже існує"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "Thêm các từ thường bị nghe nhầm hoặc viết sai trong quá trình chuyển đổi. Hệ thống sẽ tự động sửa các từ có âm thanh tương tự để khớp với danh sách của bạn.",
"placeholder": "Thêm một từ",
"add": "Thêm",
"remove": "Xóa {{word}}"
"remove": "Xóa {{word}}",
"duplicate": "\"{{word}}\" đã tồn tại"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "新增經常被誤聽或拼寫錯誤的詞彙。系統會自動將發音相似的詞彙修正為您列表中的詞彙",
"placeholder": "新增詞彙",
"add": "新增",
"remove": "刪除 {{word}}"
"remove": "刪除 {{word}}",
"duplicate": "「{{word}}」已存在"
}
},
"postProcessing": {

View file

@ -316,7 +316,8 @@
"description": "添加经常被误听或拼写错误的词汇。系统将自动将发音相似的词汇修正为您列表中的词汇。",
"placeholder": "添加词汇",
"add": "添加",
"remove": "删除 {{word}}"
"remove": "删除 {{word}}",
"duplicate": "\"{{word}}\" 已存在"
}
},
"postProcessing": {