mirror of
https://github.com/l10n-dev/obsidian-plugin-ai-translator.git
synced 2026-07-22 06:56:27 +00:00
3.6 KiB
3.6 KiB
Testing the L10n.dev - AI Translator plugin
Prerequisites
- Node.js 18 or later
- An Obsidian vault (desktop or mobile)
- A l10n.dev account and API key — get one free at l10n.dev/ws/keys
1. Get the plugin files
For testing a release — download main.js, manifest.json, and styles.css from the latest release.
For local development — build from source:
npm install
npm run build
This produces main.js in the repository root.
2. Install into your vault (desktop)
- Locate your vault folder. Inside it, open (or create) the directory:
<YourVault>/.obsidian/plugins/ai-translator/ - Copy the following files from the repository root into that folder:
main.jsmanifest.jsonstyles.css(if present)
- Open Obsidian.
- Go to Settings → Community plugins.
- If prompted, select Turn on community plugins.
- Find L10n.dev - AI Translator in the list and toggle it on.
Tip: Clone the repository directly into
<YourVault>/.obsidian/plugins/ai-translator/and runnpm run devfor live reloading during development.
3. Configure the plugin
- Open Settings → L10n.dev - AI Translator.
- Paste your l10n.dev API key into the API key field — the remaining balance should appear below it automatically.
- Choose an Output behavior and set the Translate frontmatter toggle as desired.
4. Run a translation
- Open any Markdown note.
- Trigger translation using any of these entry points:
- Command palette —
Ctrl/Cmd + P→Translate current note - Ribbon — select the globe icon in the left sidebar
- Context menu (editor) — right-click inside the note body → Translate…
- Context menu (file explorer) — right-click a
.mdfile → Translate…
- Command palette —
- Type a language name in the picker (e.g. "Spanish") and select a result.
- The output is saved according to the output behavior setting.
5. Manual test checklist
| Scenario | Expected result |
|---|---|
| Valid API key, output = create new note | {filename} ({lang-code}).md created in the same folder |
| Valid API key, output = replace | Current note content replaced |
| Valid API key, output = append | Translation appended below --- |
| Translate frontmatter OFF | YAML block at top of translated file is identical to original |
| Translate frontmatter ON | YAML block is translated along with the body |
| Wrong API key | Notice: "Invalid API key. Get your key at https://l10n.dev/ws/keys" |
| Insufficient balance | Notice: "Insufficient balance. Top up at https://l10n.dev/#pricing" |
| No note open, command triggered | Notice: "No active note to translate." |
| Language picker closed without selecting | Translation cancelled silently |
| Success | Notice shows characters used and remaining balance |
6. Mobile testing
- Build
main.json desktop (npm run build). - Transfer
main.js,manifest.json, andstyles.cssto your vault's.obsidian/plugins/ai-translator/folder using a sync solution (e.g. iCloud, Obsidian Sync, or manual file transfer). - Open Obsidian on the mobile device and enable the plugin as described in step 2.
- Repeat the manual test checklist on mobile, paying attention to the language picker and context menu behaviour.
7. Linting
npm run lint
The project uses eslint-plugin-obsidianmd for Obsidian-specific code guidelines alongside typescript-eslint.