feat: initial project prototype #1

Merged
naomi merged 5 commits from feat/init into main 2025-02-10 14:33:27 -08:00
2 changed files with 31 additions and 29 deletions
Showing only changes of commit 73873c2bc5 - Show all commits

View File

@ -15,7 +15,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"You must be subscribed to translate messages.",
"translation":
"{{translation}}\n-# Detected {{language}} with {{confidence}}% confidence.",
"unsupported-locale": "Unsupported locale.",
"unsupported-locale": "Language {{target}} is not supported by our translation software.",
},
[Locale.Indonesian]: {
"no-message-content": "Tidak ada konten pesan ditemukan.",
@ -23,7 +23,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Anda harus berlangganan untuk menerjemahkan pesan.",
"translation":
"{{translation}}\n-# Mendeteksi {{language}} dengan kepercayaan {{confidence}}%.",
"unsupported-locale": "Lokal tidak didukung.",
"unsupported-locale": "Bahasa {{target}} tidak didukung oleh perangkat lunak terjemahan kami.",
},
es: {
"no-message-content": "No se encontró contenido del mensaje.",
@ -31,7 +31,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Debes estar suscrito para traducir mensajes.",
"translation":
"{{translation}}\n-# Detectado {{language}} con {{confidence}}% de confianza.",
"unsupported-locale": "Lugar no compatible.",
"unsupported-locale": "El idioma {{target}} no es compatible con nuestro software de traducción.",
},
pt: {
"no-message-content": "Nenhum conteúdo de mensagem encontrado.",
@ -39,7 +39,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Você deve estar inscrito para traduzir mensagens.",
"translation":
"{{translation}}\n-# Detectado {{language}} com {{confidence}}% de confiança.",
"unsupported-locale": "Local não suportado.",
"unsupported-locale": "O idioma {{target}} não é suportado pelo nosso software de tradução.",
},
[Locale.Czech]: {
"no-message-content": "Nebyl nalezen žádný obsah zprávy.",
@ -47,7 +47,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Musíte být přihlášeni k překladu zpráv.",
"translation":
"{{translation}}\n-# Detekováno {{language}} s důvěrou {{confidence}}%.",
"unsupported-locale": "Nepodporované místo.",
"unsupported-locale": "Jazyk {{target}} není podporován naším překladovým softwarem.",
},
[Locale.Danish]: {
"no-message-content": "Ingen beskedindhold fundet.",
@ -55,7 +55,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Du skal være tilmeldt for at oversætte beskeder.",
"translation":
"{{translation}}\n-# Detekteret {{language}} med {{confidence}}% tillid.",
"unsupported-locale": "Ikke understøttet sted.",
"unsupported-locale": "Sproget {{target}} understøttes ikke af vores oversættelsessoftware.",
},
[Locale.Dutch]: {
"no-message-content": "Geen berichtinhoud gevonden.",
@ -63,7 +63,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"U moet zijn geabonneerd om berichten te vertalen.",
"translation":
"{{translation}}\n-# Gedetecteerd {{language}} met {{confidence}}% vertrouwen.",
"unsupported-locale": "Niet-ondersteunde locatie.",
"unsupported-locale": "Taal {{target}} wordt niet ondersteund door onze vertaalsoftware.",
},
[Locale.Finnish]: {
"no-message-content": "Ei viestisisältöä löytynyt.",
@ -71,7 +71,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Sinun on tilattava viestien kääntämiseksi.",
"translation":
"{{translation}}\n-# Havaittu {{language}} {{confidence}}% luottamuksella.",
"unsupported-locale": "Ei tuettu paikka.",
"unsupported-locale": "Kieltä {{target}} ei tueta käännössovelluksellamme.",
},
[Locale.French]: {
"no-message-content": "Aucun contenu de message trouvé.",
@ -79,7 +79,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Vous devez être abonné pour traduire les messages.",
"translation":
"{{translation}}\n-# Détecté {{language}} avec {{confidence}}% de confiance.",
"unsupported-locale": "Lieu non pris en charge.",
"unsupported-locale": "La langue {{target}} n'est pas prise en charge par notre logiciel de traduction.",
},
[Locale.German]: {
"no-message-content": "Kein Nachrichteninhalt gefunden.",
@ -87,7 +87,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Sie müssen abonniert sein, um Nachrichten zu übersetzen.",
"translation":
"{{translation}}\n-# Erkannt {{language}} mit {{confidence}}% Vertrauen.",
"unsupported-locale": "Nicht unterstützter Ort.",
"unsupported-locale": "Die Sprache {{target}} wird von unserer Übersetzungssoftware nicht unterstützt.",
},
[Locale.Greek]: {
"no-message-content": "Δεν βρέθηκε περιεχόμενο μηνύματος.",
@ -95,7 +95,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Πρέπει να είστε συνδρομητής για να μεταφράσετε μηνύματα.",
"translation":
"{{translation}}\n-# Ανιχνεύθηκε {{language}} με {{confidence}}% εμπιστοσύνη.",
"unsupported-locale": "Μη υποστηριζόμενη τοποθεσία.",
"unsupported-locale": "Η γλώσσα {{target}} δεν υποστηρίζεται από το λογισμικό μετάφρασής μας.",
},
[Locale.Hindi]: {
"no-message-content": "कोई संदेश सामग्री नहीं मिली।",
@ -103,7 +103,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"आपको संदेश अनुवाद करने के लिए सब्सक्राइब करना होगा।",
"translation":
"{{translation}}\n-# {{confidence}}% विश्वास के साथ {{language}} का पता लगाया गया।",
"unsupported-locale": "असमर्थित स्थान।",
"unsupported-locale": "हमारे अनुवाद सॉफ़्टवेयर द्वारा {{target}} भाषा का समर्थन नहीं किया जाता है।",
},
[Locale.Hungarian]: {
"no-message-content": "Nem található üzenettartalom.",
@ -111,7 +111,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Fel kell iratkoznia az üzenetek fordításához.",
"translation":
"{{translation}}\n-# {{language}} érzékelve {{confidence}}% bizalommal.",
"unsupported-locale": "Nem támogatott hely.",
"unsupported-locale": "A {{target}} nyelvet nem támogatja fordító szoftverünk.",
},
[Locale.Italian]: {
"no-message-content": "Nessun contenuto del messaggio trovato.",
@ -119,7 +119,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Devi essere abbonato per tradurre i messaggi.",
"translation":
"{{translation}}\n-# Rilevato {{language}} con {{confidence}}% di fiducia.",
"unsupported-locale": "Località non supportata.",
"unsupported-locale": "La lingua {{target}} non è supportata dal nostro software di traduzione.",
},
[Locale.Japanese]: {
"no-message-content": "メッセージコンテンツが見つかりません。",
@ -127,7 +127,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"メッセージを翻訳するには購読する必要があります。",
"translation":
"{{translation}}\n-# {{confidence}}% の信頼度で {{language}} を検出しました。",
"unsupported-locale": "サポートされていないロケール。",
"unsupported-locale": "{{target}} 言語は、翻訳ソフトウェアでサポートされていません。",
},
[Locale.Korean]: {
"no-message-content": "메시지 내용을 찾을 수 없습니다.",
@ -135,7 +135,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"메시지를 번역하려면 구독해야 합니다.",
"translation":
"{{translation}}\n-# {{confidence}}% 신뢰도로 {{language}} 감지.",
"unsupported-locale": "지원되지 않는 로케일.",
"unsupported-locale": "{{target}} 언어는 번역 소프트웨어에서 지원되지 않습니다.",
},
[Locale.Lithuanian]: {
"no-message-content": "Nerasta jokio pranešimo turinio.",
@ -143,7 +143,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Norint išversti žinutes, turite būti prenumeratorius.",
"translation":
"{{translation}}\n-# Aptikta {{language}} su {{confidence}}% pasitikėjimu.",
"unsupported-locale": "Nepalaikomas vietovė.",
"unsupported-locale": "{{target}} kalba nepalaikoma mūsų vertimo programine įranga.",
},
[Locale.Polish]: {
"no-message-content": "Nie znaleziono treści wiadomości.",
@ -151,7 +151,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Aby tłumaczyć wiadomości, musisz być subskrybentem.",
"translation":
"{{translation}}\n-# Wykryto {{language}} z {{confidence}}% pewnością.",
"unsupported-locale": "Nieobsługiwane miejsce.",
"unsupported-locale": "Język {{target}} nie jest obsługiwany przez nasze oprogramowanie do tłumaczenia.",
},
sv: {
"no-message-content": "Inget meddelandeinnehåll hittades.",
@ -159,7 +159,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Du måste prenumerera för att översätta meddelanden.",
"translation":
"{{translation}}\n-# Upptäckt {{language}} med {{confidence}}% förtroende.",
"unsupported-locale": "Ej understödd plats.",
"unsupported-locale": "Språket {{target}} stöds inte av vår översättningsprogramvara.",
},
[Locale.Romanian]: {
"no-message-content": "Nu s-a găsit niciun conținut de mesaj.",
@ -167,7 +167,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Trebuie să fiți abonat pentru a traduce mesajele.",
"translation":
"{{translation}}\n-# Detectat {{language}} cu {{confidence}}% încredere.",
"unsupported-locale": "Locație neacceptată.",
"unsupported-locale": "Limba {{target}} nu este acceptată de software-ul nostru de traducere.",
},
[Locale.Russian]: {
"no-message-content": "Содержимое сообщения не найдено.",
@ -175,21 +175,21 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Вы должны быть подписаны на перевод сообщений.",
"translation":
"{{translation}}\n-# Обнаружен {{language}} с {{confidence}}% уверенностью.",
"unsupported-locale": "Неподдерживаемое место.",
"unsupported-locale": "Язык {{target}} не поддерживается нашим программным обеспечением для перевода.",
},
zh: {
"no-message-content": "未找到消息内容。",
"subscription-required": "您必须订阅以翻译消息。",
"translation":
"{{translation}}\n-# 检测到 {{language}}{{confidence}}% 的信心。",
"unsupported-locale": "不支持的区域。",
"unsupported-locale": "我们的翻译软件不支持 {{target}} 语言。",
},
zt: {
"no-message-content": "未找到消息内容。",
"subscription-required": "您必须订阅以翻译消息。",
"translation":
"{{translation}}\n-# 检测到 {{language}}{{confidence}}% 的信心。",
"unsupported-locale": "不支持的区域。",
"unsupported-locale": "我们的翻译软件不支持 {{target}} 语言。",
},
[Locale.Thai]: {
"no-message-content": "ไม่พบเนื้อหาข้อความ",
@ -197,7 +197,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"คุณต้องสมัครสมาชิกเพื่อแปลข้อความ",
"translation":
"{{translation}}\n-# ตรวจพบ {{language}} ด้วยความมั่นใจ {{confidence}}%",
"unsupported-locale": "ที่ตั้งที่ไม่รองรับ",
"unsupported-locale": "ภาษา {{target}} ไม่ได้รับการสนับสนุนโดยซอฟต์แวร์แปลของเรา",
},
[Locale.Turkish]: {
"no-message-content": "Hiçbir mesaj içeriği bulunamadı.",
@ -205,7 +205,7 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Mesajları çevirmek için abone olmalısınız.",
"translation":
"{{translation}}\n-# {{confidence}}% güvenle {{language}} tespit edildi.",
"unsupported-locale": "Desteklenmeyen yer.",
"unsupported-locale": "{{target}} dilimiz tarafından desteklenmiyor.",
},
[Locale.Ukrainian]: {
"no-message-content": "Не знайдено вмісту повідомлення.",
@ -213,6 +213,6 @@ export const responses: Record<string, { "no-message-content": string; "subscrip
"Ви повинні підписатися на переклад повідомлень.",
"translation":
"{{translation}}\n-# Виявлено {{language}} з {{confidence}}% впевненістю.",
"unsupported-locale": "Непідтримуване місце.",
"unsupported-locale": "Мова {{target}} не підтримується нашим програмним забезпеченням для перекладу.",
},
};

View File

@ -16,7 +16,7 @@ import { getLocale } from "./getLocale.js";
* Translates a message to the user's locale.
* @param interaction -- The interaction payload from Discord.
*/
// eslint-disable-next-line max-statements, max-lines-per-function, complexity -- This is a complex function.
// eslint-disable-next-line max-statements, max-lines-per-function -- This is a complex function.
export const translate = async(
interaction: MessageContextMenuCommandInteraction,
): Promise<void> => {
@ -27,7 +27,7 @@ export const translate = async(
return entitlement.userId === interaction.user.id && entitlement.isActive();
});
if (!isEntitled && interaction.user.id !== "465650873650118659") {
if (!isEntitled) {
await interaction.editReply({
content: i18n("subscription-required", targetLocale),
});
@ -35,7 +35,9 @@ export const translate = async(
}
if (!supportedLocales.includes(targetLocale)) {
await interaction.editReply(i18n("unsupported-locale", targetLocale));
await interaction.editReply(i18n("unsupported-locale", targetLocale, {
target: targetLocale,
}));
return;
}