mirror of
https://github.com/l10n-dev/obsidian-plugin-ai-translator.git
synced 2026-07-22 06:56:27 +00:00
Usage details notification is fixed
This commit is contained in:
parent
c11592fc81
commit
b715303b9a
17 changed files with 67 additions and 42 deletions
|
|
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.2.2] — 2026-07-14
|
||||
|
||||
- Usage details notification is fixed
|
||||
|
||||
## [1.2.1] — 2026-07-13
|
||||
|
||||
- Usage details are added to the Translation complete notification
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "note-ai-translator",
|
||||
"name": "L10n.dev - AI Translator",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"minAppVersion": "1.1.7",
|
||||
"description": "Translate notes into any of 165 languages with AI. Preserves Markdown formatting and structure. Powered by L10n.dev's AI translation API. Supports json, yaml, other plain-text formats.",
|
||||
"author": "l10n.dev",
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "obsidian-plugin-ai-translator",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "obsidian-plugin-ai-translator",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"obsidian": "latest"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "obsidian-plugin-ai-translator",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"description": "Obsidian plugin to translate notes with AI using l10n.dev",
|
||||
"main": "main.js",
|
||||
"type": "module",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "Ungültiger API-Schlüssel. Erhalten Sie Ihren Schlüssel unter {{url}}",
|
||||
"noticeInsufficientBalance": "Guthaben nicht ausreichend. Laden Sie es unter {{url}} auf.",
|
||||
"noticeTranslationFailed": "Übersetzung fehlgeschlagen. Bitte versuchen Sie es erneut.",
|
||||
"noticeTranslationComplete": "Übersetzung abgeschlossen. Es wurden {{count}} Zeichen verwendet (Inhalt {{sourceCount}}, Lexikon {{glossaryCount}}, Anweisung {{instructionCount}}, Terminologie {{terminologyCount}})",
|
||||
"noticeRemainingBalance": " {{count}} Zeichen verbleibend.",
|
||||
"noticeTranslationComplete": "Übersetzung abgeschlossen. {{count}} Zeichen verwendet. ",
|
||||
"noticeTranslationCompleteExtended": "Übersetzung abgeschlossen. {{count}} Zeichen verwendet (Inhalt {{sourceCount}}, Lexikon {{glossaryCount}}, Anweisung {{instructionCount}}). ",
|
||||
"noticeRemainingBalance": "Noch {{count}} Zeichen verfügbar.",
|
||||
"noticeSaveFailed": "Übersetzte Notiz konnte nicht gespeichert werden.",
|
||||
"noticeSetApiKey": "Bitte legen Sie Ihren l10n.dev API-Schlüssel in den Einstellungen fest.",
|
||||
"noticeNoActiveNote": "Keine aktive Notiz zum Übersetzen.",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "Invalid API key. Get your key at {{url}}",
|
||||
"noticeInsufficientBalance": "Insufficient balance. Top up at {{url}}",
|
||||
"noticeTranslationFailed": "Translation failed. Please try again.",
|
||||
"noticeTranslationComplete": "Translation complete. Used {{count}} characters (content {{sourceCount}}, glossary {{glossaryCount}}, instruction {{instructionCount}}, terminology {{terminologyCount}})",
|
||||
"noticeRemainingBalance": " {{count}} characters remaining.",
|
||||
"noticeTranslationComplete": "Translation complete. Used {{count}} characters. ",
|
||||
"noticeTranslationCompleteExtended": "Translation complete. Used {{count}} characters (content {{sourceCount}}, glossary {{glossaryCount}}, instruction {{instructionCount}}). ",
|
||||
"noticeRemainingBalance": "Remaining {{count}} characters.",
|
||||
"noticeSaveFailed": "Failed to save the translated note.",
|
||||
"noticeSetApiKey": "Please set your l10n.dev API key in settings.",
|
||||
"noticeNoActiveNote": "No active note to translate.",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "API key no válida. Obtén tu clave en {{url}}",
|
||||
"noticeInsufficientBalance": "Saldo insuficiente. Recarga en {{url}}",
|
||||
"noticeTranslationFailed": "Error en la traducción. Por favor, inténtalo de nuevo.",
|
||||
"noticeTranslationComplete": "Traducción completada. Se utilizaron {{count}} caracteres (contenido {{sourceCount}}, glosario {{glossaryCount}}, instrucción {{instructionCount}}, terminología {{terminologyCount}})",
|
||||
"noticeRemainingBalance": " {{count}} caracteres restantes.",
|
||||
"noticeTranslationComplete": "Traducción completada. Se usaron {{count}} caracteres. ",
|
||||
"noticeTranslationCompleteExtended": "Traducción completada. Se usaron {{count}} caracteres (contenido {{sourceCount}}, glosario {{glossaryCount}}, instrucción {{instructionCount}}). ",
|
||||
"noticeRemainingBalance": "Quedan {{count}} caracteres.",
|
||||
"noticeSaveFailed": "Error al guardar la nota traducida.",
|
||||
"noticeSetApiKey": "Por favor, configura tu API key de l10n.dev en los ajustes.",
|
||||
"noticeNoActiveNote": "No hay ninguna nota activa para traducir.",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "Clé API invalide. Obtenez votre clé sur {{url}}",
|
||||
"noticeInsufficientBalance": "Solde insuffisant. Rechargez sur {{url}}",
|
||||
"noticeTranslationFailed": "La traduction a échoué. Veuillez réessayer.",
|
||||
"noticeTranslationComplete": "Traduction terminée. Utilisé {{count}} caractères (contenu {{sourceCount}}, glossaire {{glossaryCount}}, instruction {{instructionCount}}, terminologie {{terminologyCount}})",
|
||||
"noticeRemainingBalance": " {{count}} caractères restants.",
|
||||
"noticeTranslationComplete": "Traduction terminée. {{count}} caractères utilisés. ",
|
||||
"noticeTranslationCompleteExtended": "Traduction terminée. Utilisation de {{count}} caractères (contenu {{sourceCount}}, glossaire {{glossaryCount}}, instruction {{instructionCount}}). ",
|
||||
"noticeRemainingBalance": "{{count}} caractères restants.",
|
||||
"noticeSaveFailed": "Échec de l'enregistrement de la note traduite.",
|
||||
"noticeSetApiKey": "Veuillez définir votre clé API l10n.dev dans les paramètres.",
|
||||
"noticeNoActiveNote": "Aucune note active à traduire.",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "API key tidak valid. Dapatkan key Anda di {{url}}",
|
||||
"noticeInsufficientBalance": "Saldo tidak mencukupi. Isi ulang di {{url}}",
|
||||
"noticeTranslationFailed": "Terjemahan gagal. Silakan coba lagi.",
|
||||
"noticeTranslationComplete": "Terjemahan selesai. Menggunakan {{count}} karakter (konten {{sourceCount}}, glosarium {{glossaryCount}}, instruksi {{instructionCount}}, terminologi {{terminologyCount}})",
|
||||
"noticeRemainingBalance": " {{count}} karakter tersisa.",
|
||||
"noticeTranslationComplete": "Terjemahan selesai. Menggunakan {{count}} karakter. ",
|
||||
"noticeTranslationCompleteExtended": "Terjemahan selesai. Menggunakan {{count}} karakter (konten {{sourceCount}}, glosarium {{glossaryCount}}, instruksi {{instructionCount}}). ",
|
||||
"noticeRemainingBalance": "Sisa {{count}} karakter.",
|
||||
"noticeSaveFailed": "Gagal menyimpan catatan yang diterjemahkan.",
|
||||
"noticeSetApiKey": "Harap atur API key l10n.dev Anda di pengaturan.",
|
||||
"noticeNoActiveNote": "Tidak ada catatan aktif untuk diterjemahkan.",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "Chiave API non valida. Ottieni la tua chiave su {{url}}",
|
||||
"noticeInsufficientBalance": "Saldo insufficiente. Ricarica su {{url}}",
|
||||
"noticeTranslationFailed": "Traduzione non riuscita. Riprova.",
|
||||
"noticeTranslationComplete": "Traduzione completata. Utilizzati {{count}} caratteri (contenuto {{sourceCount}}, glossario {{glossaryCount}}, istruzione {{instructionCount}}, terminologia {{terminologyCount}})",
|
||||
"noticeRemainingBalance": " {{count}} caratteri rimanenti.",
|
||||
"noticeTranslationComplete": "Traduzione completata. Sono stati usati {{count}} caratteri. ",
|
||||
"noticeTranslationCompleteExtended": "Traduzione completata. Utilizzati {{count}} caratteri (contenuto {{sourceCount}}, glossario {{glossaryCount}}, istruzione {{instructionCount}}). ",
|
||||
"noticeRemainingBalance": "{{count}} caratteri rimanenti.",
|
||||
"noticeSaveFailed": "Salvataggio della nota tradotta non riuscito.",
|
||||
"noticeSetApiKey": "Imposta la tua chiave API l10n.dev nelle impostazioni.",
|
||||
"noticeNoActiveNote": "Nessuna nota attiva da tradurre.",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "無効なAPIキーです。キーの取得はこちら: {{url}}",
|
||||
"noticeInsufficientBalance": "残高不足です。チャージはこちら: {{url}}",
|
||||
"noticeTranslationFailed": "翻訳に失敗しました。もう一度お試しください。",
|
||||
"noticeTranslationComplete": "翻訳が完了しました。{{count}}文字を使用しました(コンテンツ {{sourceCount}}、用語集 {{glossaryCount}}、指示 {{instructionCount}}、用語 {{terminologyCount}})",
|
||||
"noticeRemainingBalance": " 残り{{count}}文字です。",
|
||||
"noticeTranslationComplete": "翻訳が完了しました。{{count}}文字を使用しました。",
|
||||
"noticeTranslationCompleteExtended": "翻訳が完了しました。{{count}}文字を使用しました(コンテンツ{{sourceCount}}、用語集{{glossaryCount}}、言語指示{{instructionCount}})。",
|
||||
"noticeRemainingBalance": "残り{{count}}文字。",
|
||||
"noticeSaveFailed": "翻訳されたノートの保存に失敗しました。",
|
||||
"noticeSetApiKey": "設定でl10n.devのAPIキーを設定してください。",
|
||||
"noticeNoActiveNote": "翻訳するアクティブなノートがありません。",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "유효하지 않은 API 키입니다. 다음에서 키를 발급받으세요: {{url}}",
|
||||
"noticeInsufficientBalance": "잔액이 부족합니다. 다음에서 충전하세요: {{url}}",
|
||||
"noticeTranslationFailed": "번역에 실패했습니다. 다시 시도해 주세요.",
|
||||
"noticeTranslationComplete": "번역이 완료되었습니다. {{count}}개의 문자를 사용했습니다 (콘텐츠 {{sourceCount}}, 용어집 {{glossaryCount}}, 지침 {{instructionCount}}, 용어 {{terminologyCount}})",
|
||||
"noticeRemainingBalance": " {{count}} 문자 남음.",
|
||||
"noticeTranslationComplete": "번역 완료. {{count}}자 사용됨. ",
|
||||
"noticeTranslationCompleteExtended": "번역이 완료되었습니다. {{count}}자를 사용했습니다 (콘텐츠 {{sourceCount}}, 용어집 {{glossaryCount}}, 지침 {{instructionCount}}). ",
|
||||
"noticeRemainingBalance": "남은 문자 수: {{count}}자.",
|
||||
"noticeSaveFailed": "번역된 노트를 저장하지 못했습니다.",
|
||||
"noticeSetApiKey": "설정에서 l10n.dev API 키를 설정해 주세요.",
|
||||
"noticeNoActiveNote": "번역할 활성화된 노트가 없습니다.",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "Chave de API inválida. Obtenha sua chave em {{url}}",
|
||||
"noticeInsufficientBalance": "Saldo insuficiente. Recarregue em {{url}}",
|
||||
"noticeTranslationFailed": "Falha na tradução. Tente novamente.",
|
||||
"noticeTranslationComplete": "Tradução concluída. Foram usados {{count}} caracteres (conteúdo {{sourceCount}}, glossário {{glossaryCount}}, instrução {{instructionCount}}, terminologia {{terminologyCount}})",
|
||||
"noticeRemainingBalance": " {{count}} caracteres restantes.",
|
||||
"noticeTranslationComplete": "Tradução concluída. {{count}} caracteres usados. ",
|
||||
"noticeTranslationCompleteExtended": "Tradução concluída. {{count}} caracteres usados (conteúdo {{sourceCount}}, glossário {{glossaryCount}}, instrução {{instructionCount}}). ",
|
||||
"noticeRemainingBalance": "{{count}} caracteres restantes.",
|
||||
"noticeSaveFailed": "Falha ao salvar a nota traduzida.",
|
||||
"noticeSetApiKey": "Por favor, defina sua chave de API l10n.dev nas configurações.",
|
||||
"noticeNoActiveNote": "Nenhuma nota ativa para traduzir.",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "API密钥无效。请在 {{url}} 获取您的密钥",
|
||||
"noticeInsufficientBalance": "余额不足。请在 {{url}} 充值",
|
||||
"noticeTranslationFailed": "翻译失败。请重试。",
|
||||
"noticeTranslationComplete": "翻译完成。已使用 {{count}} 个字符(内容 {{sourceCount}},词汇表 {{glossaryCount}},指令 {{instructionCount}},术语 {{terminologyCount}})",
|
||||
"noticeRemainingBalance": " 剩余 {{count}} 个字符。",
|
||||
"noticeTranslationComplete": "翻译完成。已使用 {{count}} 个字符。",
|
||||
"noticeTranslationCompleteExtended": "翻译完成。已使用 {{count}} 个字符(内容 {{sourceCount}},词汇表 {{glossaryCount}},语言指令 {{instructionCount}})。",
|
||||
"noticeRemainingBalance": "剩余 {{count}} 个字符。",
|
||||
"noticeSaveFailed": "保存翻译后的笔记失败。",
|
||||
"noticeSetApiKey": "请在设置中配置您的l10n.dev API密钥。",
|
||||
"noticeNoActiveNote": "没有可翻译的活动笔记。",
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
"noticeInvalidKey": "API 金鑰無效。請至 {{url}} 取得您的金鑰",
|
||||
"noticeInsufficientBalance": "餘額不足。請至 {{url}} 加值",
|
||||
"noticeTranslationFailed": "翻譯失敗。請再試一次。",
|
||||
"noticeTranslationComplete": "翻譯完成。已使用 {{count}} 個字元(內容 {{sourceCount}}、詞彙表 {{glossaryCount}}、指令 {{instructionCount}}、術語 {{terminologyCount}})",
|
||||
"noticeRemainingBalance": "剩餘 {{count}} 字元。",
|
||||
"noticeTranslationComplete": "翻譯完成。使用了 {{count}} 個字元。",
|
||||
"noticeTranslationCompleteExtended": "翻譯完成。已使用 {{count}} 個字元 (內容 {{sourceCount}}、詞彙表 {{glossaryCount}}、語言指令 {{instructionCount}})。",
|
||||
"noticeRemainingBalance": "剩餘 {{count}} 個字元。",
|
||||
"noticeSaveFailed": "儲存翻譯後的筆記失敗。",
|
||||
"noticeSetApiKey": "請在設定中設定您的 l10n.dev API 金鑰。",
|
||||
"noticeNoActiveNote": "沒有可翻譯的有效筆記。",
|
||||
|
|
|
|||
|
|
@ -117,21 +117,30 @@ async function doTranslate(
|
|||
count: remainingBalance.toLocaleString(),
|
||||
})
|
||||
: "";
|
||||
new Notice(
|
||||
t("noticeTranslationComplete", {
|
||||
count: usage.charsUsed.toLocaleString(),
|
||||
sourceCount:
|
||||
usage.details.sourceStringsCharCount.toLocaleString(),
|
||||
glossaryCount: usage.details.glossaryCharCount.toLocaleString(),
|
||||
instructionCount:
|
||||
usage.details.instructionCharCount.toLocaleString(),
|
||||
terminologyCount:
|
||||
usage.details.terminologyCharCount.toLocaleString(),
|
||||
}) +
|
||||
"\r\n\r\n" +
|
||||
balanceText,
|
||||
20000,
|
||||
);
|
||||
|
||||
if (usage.charsUsed > usage.details.sourceStringsCharCount) {
|
||||
new Notice(
|
||||
t("noticeTranslationCompleteExtended", {
|
||||
count: usage.charsUsed.toLocaleString(),
|
||||
sourceCount:
|
||||
usage.details.sourceStringsCharCount.toLocaleString(),
|
||||
glossaryCount:
|
||||
usage.details.glossaryCharCount.toLocaleString(),
|
||||
instructionCount:
|
||||
usage.details.instructionCharCount.toLocaleString(),
|
||||
terminologyCount:
|
||||
usage.details.terminologyCharCount.toLocaleString(),
|
||||
}) + (remainingBalance != null ? "\r\n\r\n" + balanceText : ""),
|
||||
20000,
|
||||
);
|
||||
} else {
|
||||
new Notice(
|
||||
t("noticeTranslationComplete", {
|
||||
count: usage.charsUsed.toLocaleString(),
|
||||
}) + balanceText,
|
||||
20000,
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
new Notice(t("noticeSaveFailed"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@
|
|||
"1.1.1": "1.1.7",
|
||||
"1.1.2": "1.1.7",
|
||||
"1.2.0": "1.1.7",
|
||||
"1.2.1": "1.1.7"
|
||||
"1.2.1": "1.1.7",
|
||||
"1.2.2": "1.1.7"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue