glotfile 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,7 +32,7 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
32
32
  <h2>The command line</h2>
33
33
  <ul>
34
34
  <li>CLI Overview — every command at a glance</li>
35
- <li>serve · translate · export · lint and check · import (🚧 coming soon)</li>
35
+ <li>serve · translate · export · lint and check · import</li>
36
36
  </ul>
37
37
  <h2>AI translation</h2>
38
38
  <ul>
@@ -56,7 +56,7 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
56
56
  <ul>
57
57
  <li>Troubleshooting and FAQ</li>
58
58
  </ul>
59
- `},{id:`getting-started/installation`,title:`Installation`,section:`Getting Started`,html:`<h1>Installation</h1>
59
+ `,text:`Glotfile A local-first, git-native translation manager . All of your app's copy lives in one JSON file you commit to your repo. You edit and AI-translate it through a local web UI, then export to whatever locale formats your apps consume — no SaaS, no hosted database, nothing leaves your machine except the AI calls you choose to make. This is the home page of the user guide. Everything is linked from here. Start here - Installation — requirements and how to run Glotfile - Quick Start — from zero to translated strings in five minutes - Translation Workflow — the day-to-day loop, end to end Core concepts - The State File — , the single source of truth - Keys and Locales — how strings and languages are organised - Review States — → → / - Plurals — CLDR plural forms - Glossary — do-not-translate and forced terms - Key Context and Metadata — context, notes, tags, length limits, screenshots The web UI - Web UI Overview — the panels and how they fit together - Editor · Analytics · Screenshots · Settings · AI Log The command line - CLI Overview — every command at a glance - serve · translate · export · lint and check · import AI translation - How Translation Works — what the translator does for you - AI Providers — Anthropic, OpenAI, AWS Bedrock, and OpenRouter setup Reference - Output Formats — the six export adapters - Checks and Validation — every rule and what it catches - Configuration Reference — every field in - Placeholders and ICU — what's preserved across formats Guides - Translation Workflow — author → translate → review → export - Continuous Integration — gate merges on translation health - Keeping Translations Fresh — handling source changes Help - Troubleshooting and FAQ`},{id:`getting-started/installation`,title:`Installation`,section:`Getting Started`,html:`<h1>Installation</h1>
60
60
  <h2>Requirements</h2>
61
61
  <ul>
62
62
  <li><strong>Node.js</strong> <code>^20.19.0 || &gt;=22.12.0</code></li>
@@ -84,7 +84,7 @@ node bin/glotfile.js # equivalent to the \`glotfile\` command
84
84
  <li>If not, it starts from sensible defaults and <strong>writes the file as soon as you make your first edit</strong>.</li>
85
85
  </ul>
86
86
  <blockquote>
87
- <p><strong>Info:</strong> Already have locale files? — Importing an existing project (reading your current <code>.arb</code> / <code>.php</code> / <code>.json</code> files <em>into</em> the catalog) is <strong>🚧 coming soon</strong> — see import. For now, add keys through the Editor or point Glotfile at a fresh directory.</p>
87
+ <p><strong>Info:</strong> Already have locale files? — Import an existing project by reading your current <code>.arb</code> / <code>.php</code> / <code>.json</code> files <em>into</em> the catalog with <code>glotfile import</code> — see import.</p>
88
88
  </blockquote>
89
89
  <h2>Targeting a different file</h2>
90
90
  <p>Every command accepts <code>--file</code> (<code>-f</code>) to use a state file other than <code>./glotfile.json</code>:</p>
@@ -99,7 +99,7 @@ node bin/glotfile.js # equivalent to the \`glotfile\` command
99
99
  <li>Quick Start — translate your first strings</li>
100
100
  <li>The State File — understand what <code>glotfile.json</code> holds</li>
101
101
  </ul>
102
- `},{id:`getting-started/quick-start`,title:`Quick Start`,section:`Getting Started`,html:`<h1>Quick Start</h1>
102
+ `,text:`Installation Requirements - Node.js That's the only hard requirement. Everything except AI translation runs fully offline, with no account and no network access. Running Glotfile Glotfile is designed to run with no install via : ⚠ Pre-1.0: run from a checkout for now — Glotfile is pre-1.0 and not yet published to npm. Until it is, run it from a clone of the repo: Once published, and a global install will both work. Throughout these docs, and are interchangeable. First run Run Glotfile from the root of the project whose copy you want to manage: This starts a local server bound to , opens your browser, and: - If a already exists in the current directory, it loads it. - If not, it starts from sensible defaults and writes the file as soon as you make your first edit . Info: Already have locale files? — Import an existing project by reading your current / / files into the catalog with — see import. Targeting a different file Every command accepts ( ) to use a state file other than : Developing Glotfile itself If you're hacking on Glotfile (not just using it), run the Vite UI with hot-reload alongside the server: Next steps - Quick Start — translate your first strings - The State File — understand what holds`},{id:`getting-started/quick-start`,title:`Quick Start`,section:`Getting Started`,html:`<h1>Quick Start</h1>
103
103
  <p>This walks you from an empty project to translated, exported strings. It assumes you&#39;ve done Installation.</p>
104
104
  <h2>1. Start the UI</h2>
105
105
  <p>From your project root:</p>
@@ -159,7 +159,7 @@ git commit -m &quot;Add sign-in copy + translations&quot;
159
159
  <li>Continuous Integration — keep translations healthy in CI</li>
160
160
  <li>The State File — what&#39;s actually in <code>glotfile.json</code></li>
161
161
  </ul>
162
- `},{id:`web-ui/ai-log`,title:`AI Log`,section:`Web UI`,html:`<h1>AI Log</h1>
162
+ `,text:`Quick Start This walks you from an empty project to translated, exported strings. It assumes you've done Installation. 1. Start the UI From your project root: Your browser opens the Editor. If there's no yet, Glotfile uses defaults and writes the file on your first edit. 2. Add your languages Open Settings and set: - Source locale — the language you author in (e.g. ). - Locales — every language you want to maintain (e.g. , , ). See Keys and Locales for how locales work. 3. Add keys and source copy In the Editor, add a key in dot notation and type its source string: Key (source) --- --- The source value is saved with the state . 4. AI-translate the rest Info: One-time setup — AI translation needs an API key in your environment. The default provider is Anthropic — set (a local file works). See AI Providers for OpenAI and AWS Bedrock. Fill the empty languages — from the Editor's translate action, or the CLI: New translations are written as state. Glotfile never overwrites a value you've marked . See How Translation Works. 5. Review Back in the Editor, filter to machine to see unreviewed translations. Promote the good ones to ; flag the rest. See Review States. 6. Export to your app's formats Configure where files go in Settings (or Output Formats), then: This writes the locale files for every configured output (Flutter ARB, Laravel PHP, i18next JSON, and more — see Output Formats). 7. Commit Commit together with your code. The diff is the review: Because the catalog is just a file in your repo, branching, pull-request review, and rollback work exactly the way they already do for code. Where to go next - Translation Workflow — the same loop, in depth - Continuous Integration — keep translations healthy in CI - The State File — what's actually in`},{id:`web-ui/ai-log`,title:`AI Log`,section:`Web UI`,html:`<h1>AI Log</h1>
163
163
  <p>The AI Log is a record of recent translation runs — what was sent to the provider and what came back. It&#39;s useful for understanding why a translation turned out the way it did, and for auditing what left your machine.</p>
164
164
  <h2>What each entry records</h2>
165
165
  <p>For every run:</p>
@@ -182,7 +182,7 @@ git commit -m &quot;Add sign-in copy + translations&quot;
182
182
  <ul>
183
183
  <li>How Translation Works · AI Providers</li>
184
184
  </ul>
185
- `},{id:`web-ui/analytics`,title:`Analytics`,section:`Web UI`,html:`<h1>Analytics</h1>
185
+ `,text:`AI Log The AI Log is a record of recent translation runs — what was sent to the provider and what came back. It's useful for understanding why a translation turned out the way it did, and for auditing what left your machine. What each entry records For every run: - When it ran and the model used. - The system prompt that framed the request. - Per string: the key , source , target locale , the context and relevant glossary hints sent, and whether the key had a screenshot . - The results returned (translation or plural forms, or an error). What it deliberately does not record ⚠ The log is egress-only and credential-free - No API keys are ever written to the log (or to ). - No screenshot bytes — only the fact that a key had one. In other words: the AI Log shows exactly what crossed the network boundary, and nothing more. Related - How Translation Works · AI Providers`},{id:`web-ui/analytics`,title:`Analytics`,section:`Web UI`,html:`<h1>Analytics</h1>
186
186
  <p>The Analytics panel answers one question — <strong>can I ship?</strong> — plus the detail behind the answer: how complete and how reviewed your catalog is per locale, and what&#39;s blocking a release.</p>
187
187
  <h2>The release gate</h2>
188
188
  <p>The &quot;Ready to ship&quot; verdict is computed from the <strong>same lint report as <code>glotfile check</code></strong>: the lint rules over your catalog plus the output-drift check. If the CLI fails, the panel shows the same blockers, and vice versa — the two can never disagree.</p>
@@ -223,7 +223,7 @@ git commit -m &quot;Add sign-in copy + translations&quot;
223
223
  <ul>
224
224
  <li>Review States · Editor · Checks and Validation · Lint and Check (CLI)</li>
225
225
  </ul>
226
- `},{id:`web-ui/editor`,title:`Editor`,section:`Web UI`,html:`<h1>Editor</h1>
226
+ `,text:`Analytics The Analytics panel answers one question — can I ship? — plus the detail behind the answer: how complete and how reviewed your catalog is per locale, and what's blocking a release. The release gate The "Ready to ship" verdict is computed from the same lint report as : the lint rules over your catalog plus the output-drift check. If the CLI fails, the panel shows the same blockers, and vice versa — the two can never disagree. A locale is Ready when it clears the gate: - 100% translated (no errors) - 0 lint errors (placeholder mismatches, glossary violations, …) - Outputs exported (no stale files on disk) - Nothing stale (no needs-review strings; these mark a locale Almost rather than blocked) Reviewed state is optional — a fully machine-translated locale can ship. Skipping rules The gate honors in , exactly like the CLI. Set a rule to to skip it in both places, or change its severity: Rules at severity block the release; rules surface as warnings only. See Checks and Validation for the full rule list. Totals At the top: total keys, number of locales, overall translated % and reviewed % , open issues, and the source word count. Per locale For each target locale: - Verdict against the release gate ( Ready / Almost / Blocked ) with its blockers - Translated % and a breakdown of states: reviewed, needs-review, machine, missing - Breaking and warning counts from the lint report Click any locale, issue, or worklist item to drill into the matching strings in the Editor. Tip: Reviewed ≠ translated — a locale can be 100% translated (no missing values) but only 40% reviewed . The two percentages together tell you whether you have copy at all, and whether a human has signed off on it. Related - Review States · Editor · Checks and Validation · Lint and Check (CLI)`},{id:`web-ui/editor`,title:`Editor`,section:`Web UI`,html:`<h1>Editor</h1>
227
227
  <p>The Editor is a table of every key with the source string and each target language side by side. It&#39;s built to stay fast with thousands of keys (only visible rows are rendered).</p>
228
228
  <h2>Working with keys</h2>
229
229
  <ul>
@@ -259,7 +259,7 @@ git commit -m &quot;Add sign-in copy + translations&quot;
259
259
  <ul>
260
260
  <li>Review States · Key Context and Metadata · Analytics · translate</li>
261
261
  </ul>
262
- `},{id:`web-ui/screenshots`,title:`Screenshots`,section:`Web UI`,html:`<h1>Screenshots</h1>
262
+ `,text:`Editor The Editor is a table of every key with the source string and each target language side by side. It's built to stay fast with thousands of keys (only visible rows are rendered). Working with keys - Add a key (dot-notation name + source value). - Rename a key inline. - Delete a key. - Edit values inline — click a cell, type, commit. Editing values - Press Enter to commit an edit, Escape to cancel. - Use ↑ / ↓ arrow keys to move between rows. - Plural keys open a dedicated per-category form editor. Each value shows a state badge you can toggle as you review ( → / ). Filtering and search Free-text search plus state facets let you focus: - missing — values with no content - machine — AI translations not yet reviewed - needs-review — flagged values (e.g. source changed) - reviewed — human-approved values - needs attention — any key with an open issue You can also filter by tag and narrow to a single locale. Per-key detail panel Selecting a key opens its detail panel for metadata: context , notes , tags , max length , screenshot , the skip-translate flag, and the plural marker. Translating from the Editor The translate action runs AI translation for the current selection/filter — the same engine as . Results come back as and never overwrite values. Exporting from the Editor The export action opens a preview of exactly what will write, before any files are touched. See Output Formats. Related - Review States · Key Context and Metadata · Analytics · translate`},{id:`web-ui/screenshots`,title:`Screenshots`,section:`Web UI`,html:`<h1>Screenshots</h1>
263
263
  <p>A screenshot attached to a key shows <em>where</em> a string appears in your UI. Vision-capable AI models use it as context, which markedly improves ambiguous strings.</p>
264
264
  <h2>Attaching a screenshot</h2>
265
265
  <p>Attach an image to a key from its detail panel in the Editor, or manage images across keys in the <strong>Screenshots</strong> panel.</p>
@@ -277,7 +277,7 @@ git commit -m &quot;Add sign-in copy + translations&quot;
277
277
  <ul>
278
278
  <li>Key Context and Metadata · How Translation Works · AI Providers</li>
279
279
  </ul>
280
- `},{id:`web-ui/settings`,title:`Settings`,section:`Web UI`,html:`<h1>Settings</h1>
280
+ `,text:`Screenshots A screenshot attached to a key shows where a string appears in your UI. Vision-capable AI models use it as context, which markedly improves ambiguous strings. Attaching a screenshot Attach an image to a key from its detail panel in the Editor, or manage images across keys in the Screenshots panel. How the AI uses them During translation, a key's screenshot is sent only to vision-capable models : - Supported: Anthropic, OpenAI (gpt-4o-class), AWS Bedrock (Nova, Claude). - Not supported: AWS Bedrock Meta Llama text models — those runs proceed text-only and print a warning noting how many screenshots were skipped. So screenshots are always safe to attach: models that can't see them simply ignore them. See AI Providers for the full support matrix. Info: Screenshots never appear in the AI log — the AI Log records what was sent to a provider, but not the image bytes themselves — only that a key had a screenshot. Related - Key Context and Metadata · How Translation Works · AI Providers`},{id:`web-ui/settings`,title:`Settings`,section:`Web UI`,html:`<h1>Settings</h1>
281
281
  <p>The Settings panel edits the <code>config</code> block of <code>glotfile.json</code>. Every field here is also documented in the Configuration Reference.</p>
282
282
  <h2>What you can configure</h2>
283
283
  <ul>
@@ -297,7 +297,7 @@ git commit -m &quot;Add sign-in copy + translations&quot;
297
297
  <ul>
298
298
  <li>Configuration Reference · Output Formats · AI Providers · Checks and Validation</li>
299
299
  </ul>
300
- `},{id:`web-ui/web-ui-overview`,title:`Web UI Overview`,section:`Web UI`,html:`<h1>Web UI Overview</h1>
300
+ `,text:`Settings The Settings panel edits the block of . Every field here is also documented in the Configuration Reference. What you can configure - Source locale — the language you author in. - Locales — the languages you maintain (add / remove). See Keys and Locales. - Outputs — the export targets: adapter + path template per entry. See Output Formats. - AI — provider, model, endpoint, region, and batch size. See AI Providers. - Formatting — indent, sort keys, final newline (controls how is written). - Custom dictionary — words the spelling check should accept. Save behaviour Most edits across the UI save immediately to . In Settings, some changes are explicit: ⚠ Dictionary changes require an explicit save — edits to the custom spelling dictionary are staged and only written when you Save , so you can add several words without a write (and a git diff) per keystroke. Related - Configuration Reference · Output Formats · AI Providers · Checks and Validation`},{id:`web-ui/web-ui-overview`,title:`Web UI Overview`,section:`Web UI`,html:`<h1>Web UI Overview</h1>
301
301
  <p><code>glotfile serve</code> (or just <code>glotfile</code>) opens a single-page app for managing your catalog. It runs locally, bound to <code>127.0.0.1</code>, and writes changes straight back to <code>glotfile.json</code>.</p>
302
302
  <h2>The panels</h2>
303
303
  <p>A nav rail switches between six panels:</p>
@@ -346,48 +346,101 @@ git commit -m &quot;Add sign-in copy + translations&quot;
346
346
  <li>CLI Overview — the same operations without the browser</li>
347
347
  <li>Quick Start — a guided first run</li>
348
348
  </ul>
349
- `},{id:`cli/cli-overview`,title:`CLI Overview`,section:`CLI`,html:`<h1>CLI Overview</h1>
349
+ `,text:`Web UI Overview (or just ) opens a single-page app for managing your catalog. It runs locally, bound to , and writes changes straight back to . The panels A nav rail switches between six panels: Panel What it's for --- --- Editor The heart of the app — a searchable, filterable table of every key with the source and each translation side by side. Analytics Coverage and review progress per locale, namespace, and tag. Screenshots Attach and review images that give the AI visual context. Glossary Manage do-not-translate and forced terms — see Glossary. Settings Edit the block: locales, outputs, AI provider, formatting, dictionary. AI Log A record of recent translation runs (egress only). Cross-cutting features - Checks — the UI continuously surfaces issues (missing values, placeholder mismatches, length and glossary violations) so you can fix them as you go. - Export preview — before writing files, preview exactly what will produce. See Output Formats. - Save semantics — most edits save immediately to . A few settings (notably dictionary changes) require an explicit Save — see Settings. Privacy Nothing leaves your machine except the AI calls you choose to make. The UI is local; the AI Log never stores your API keys or screenshot bytes. Related - CLI Overview — the same operations without the browser - Quick Start — a guided first run`},{id:`cli/build-context`,title:"`glotfile build-context`",section:`CLI`,html:`<h1><code>glotfile build-context</code></h1>
350
+ <p>AI-generates a short <strong>context</strong> note for each key — what it&#39;s for, where it appears — by reading the code snippets around its usages. Better context produces better translations. Requires a prior <code>glotfile scan</code> so the usage index exists.</p>
351
+ <pre><code class="language-bash">glotfile scan
352
+ glotfile build-context
353
+ </code></pre>
354
+ <p>By default it only fills keys that have <strong>no</strong> context yet. The flags combine to narrow the run.</p>
355
+ <h2>Options</h2>
356
+ <table>
357
+ <thead>
358
+ <tr>
359
+ <th>Option</th>
360
+ <th>Description</th>
361
+ </tr>
362
+ </thead>
363
+ <tbody><tr>
364
+ <td><code>--all</code></td>
365
+ <td>(Re)build context for every key, not just those missing it.</td>
366
+ </tr>
367
+ <tr>
368
+ <td><code>--key &lt;glob&gt;</code></td>
369
+ <td>Only keys matching this glob (e.g. <code>&quot;auth.*&quot;</code>).</td>
370
+ </tr>
371
+ <tr>
372
+ <td><code>--limit &lt;n&gt;</code></td>
373
+ <td>Process at most <code>n</code> keys.</td>
374
+ </tr>
375
+ <tr>
376
+ <td><code>--since &lt;date&gt;</code></td>
377
+ <td>Only keys added or changed since this date.</td>
378
+ </tr>
379
+ <tr>
380
+ <td><code>--file</code>, <code>-f &lt;path&gt;</code></td>
381
+ <td>Target a different state file.</td>
382
+ </tr>
383
+ </tbody></table>
384
+ <p>It uses the same AI provider as <code>translate</code> (configured per-machine — see AI Providers). If no usage index is found it stops and tells you to run <code>scan</code> first.</p>
385
+ <h2>Related</h2>
386
+ <ul>
387
+ <li>scan · translate · Key Context and Metadata · AI Providers</li>
388
+ </ul>
389
+ `,text:`AI-generates a short context note for each key — what it's for, where it appears — by reading the code snippets around its usages. Better context produces better translations. Requires a prior so the usage index exists. By default it only fills keys that have no context yet. The flags combine to narrow the run. Options Option Description --- --- (Re)build context for every key, not just those missing it. Only keys matching this glob (e.g. ). Process at most keys. Only keys added or changed since this date. , Target a different state file. It uses the same AI provider as (configured per-machine — see AI Providers). If no usage index is found it stops and tells you to run first. Related - scan · translate · Key Context and Metadata · AI Providers`},{id:`cli/cli-overview`,title:`CLI Overview`,section:`CLI`,html:`<h1>CLI Overview</h1>
350
390
  <p>Run <code>glotfile &lt;command&gt;</code> (or <code>node bin/glotfile.js &lt;command&gt;</code> from a checkout — see Installation).</p>
351
391
  <table>
352
392
  <thead>
353
393
  <tr>
354
394
  <th>Command</th>
355
395
  <th>What it does</th>
356
- <th></th>
357
396
  </tr>
358
397
  </thead>
359
398
  <tbody><tr>
360
399
  <td>serve (default)</td>
361
400
  <td>Start the local web UI and open the browser.</td>
362
- <td></td>
363
401
  </tr>
364
402
  <tr>
365
403
  <td>translate</td>
366
404
  <td>AI-translate strings, writing results back to <code>glotfile.json</code>.</td>
367
- <td></td>
368
405
  </tr>
369
406
  <tr>
370
407
  <td>export</td>
371
408
  <td>Write the locale files for every configured output.</td>
372
- <td></td>
373
409
  </tr>
374
410
  <tr>
375
411
  <td>lint</td>
376
412
  <td>Report translation problems (states, placeholders, glossary, spelling…).</td>
377
- <td></td>
378
413
  </tr>
379
414
  <tr>
380
415
  <td>check</td>
381
416
  <td>CI gate: lint <strong>and</strong> verify exported files are up to date.</td>
382
- <td></td>
383
417
  </tr>
384
418
  <tr>
385
419
  <td>import</td>
386
- <td>Ingest existing locale files into the catalog.</td>
387
- <td>🚧 coming soon</td>
420
+ <td>Create <code>glotfile.json</code> from existing locale files.</td>
421
+ </tr>
422
+ <tr>
423
+ <td>build-context</td>
424
+ <td>AI-generate per-key context to improve translation (needs a prior scan).</td>
425
+ </tr>
426
+ <tr>
427
+ <td>scan</td>
428
+ <td>Index code references to keys (writes <code>.glotfile/usage.json</code>).</td>
429
+ </tr>
430
+ <tr>
431
+ <td>prune</td>
432
+ <td>Remove empty-source or unused keys (dry-run unless <code>--write</code>).</td>
433
+ </tr>
434
+ <tr>
435
+ <td>split</td>
436
+ <td>Convert <code>glotfile.json</code> into a reviewable <code>glotfile/</code> directory.</td>
437
+ </tr>
438
+ <tr>
439
+ <td>skill</td>
440
+ <td>Install the Claude Code skill for managing glotfile.</td>
388
441
  </tr>
389
442
  </tbody></table>
390
- <p>Running <code>glotfile</code> with no command is the same as <code>glotfile serve</code>.</p>
443
+ <p>Running <code>glotfile</code> with no command is the same as <code>glotfile serve</code>. Run <code>glotfile &lt;command&gt; --help</code> for a command&#39;s options.</p>
391
444
  <h2>Global option</h2>
392
445
  <p>Every command accepts <code>--file</code> (<code>-f</code>) to target a state file other than <code>./glotfile.json</code>:</p>
393
446
  <pre><code class="language-bash">glotfile translate --file packages/app/glotfile.json
@@ -407,7 +460,7 @@ glotfile export -f ./i18n/glotfile.json
407
460
  <li>Web UI Overview — the same operations in the browser</li>
408
461
  <li>Configuration Reference</li>
409
462
  </ul>
410
- `},{id:`cli/export`,title:"`glotfile export`",section:`CLI`,html:`<h1><code>glotfile export</code></h1>
463
+ `,text:`CLI Overview Run (or from a checkout — see Installation). Command What it does --- --- serve (default) Start the local web UI and open the browser. translate AI-translate strings, writing results back to . export Write the locale files for every configured output. lint Report translation problems (states, placeholders, glossary, spelling…). check CI gate: lint and verify exported files are up to date. import Create from existing locale files. build-context AI-generate per-key context to improve translation (needs a prior scan). scan Index code references to keys (writes ). prune Remove empty-source or unused keys (dry-run unless ). split Convert into a reviewable directory. skill Install the Claude Code skill for managing glotfile. Running with no command is the same as . Run for a command's options. Global option Every command accepts ( ) to target a state file other than : Exit codes - , , exit on success. - exits when there are errors (or warnings over ). - exits when there are any errors (including out-of-date exports). This is what makes and usable as CI gates — see Continuous Integration. Credentials Only translate needs network access or credentials. Glotfile reads them from the environment, including a local file in the project directory. See AI Providers. Related - Web UI Overview — the same operations in the browser - Configuration Reference`},{id:`cli/export`,title:"`glotfile export`",section:`CLI`,html:`<h1><code>glotfile export</code></h1>
411
464
  <p>Writes the locale files for every output configured in <code>config.outputs</code>, using the adapters you&#39;ve set up.</p>
412
465
  <pre><code class="language-bash">glotfile export
413
466
  </code></pre>
@@ -426,11 +479,16 @@ glotfile export -f ./i18n/glotfile.json
426
479
  <td>Export only the outputs using this adapter.</td>
427
480
  </tr>
428
481
  <tr>
482
+ <td><code>--watch</code></td>
483
+ <td>Re-export whenever the state file changes (stays running).</td>
484
+ </tr>
485
+ <tr>
429
486
  <td><code>--file</code>, <code>-f &lt;path&gt;</code></td>
430
487
  <td>Target a different state file.</td>
431
488
  </tr>
432
489
  </tbody></table>
433
490
  <pre><code class="language-bash">glotfile export --adapter laravel-php # just the Laravel files
491
+ glotfile export --watch # re-export on every change
434
492
  </code></pre>
435
493
  <h2>Warnings</h2>
436
494
  <p>Where a conversion would be lossy (a construct a target format can&#39;t represent), export prints a <strong>warning</strong> and writes the best safe output rather than corrupting the file:</p>
@@ -449,38 +507,58 @@ git diff --exit-code # non-zero if exports drifted
449
507
  <ul>
450
508
  <li>Output Formats · Placeholders and ICU · lint and check · Continuous Integration</li>
451
509
  </ul>
452
- `},{id:`cli/import`,title:"`glotfile import`",section:`CLI`,html:`<h1><code>glotfile import</code></h1>
453
- <blockquote>
454
- <p><strong>Info:</strong> 🚧 Coming soon — import is <strong>not yet available</strong> in the current build. This page describes the planned behaviour so you know what&#39;s on the way. Until it ships, add keys through the Editor.</p>
455
- </blockquote>
456
- <p>Import will be the inverse of <code>glotfile export</code>: it reads your <strong>existing</strong> locale files and ingests them <em>into</em> <code>glotfile.json</code>, so you can onboard a project that already has translations without re-keying everything by hand.</p>
457
- <h2>Planned shape</h2>
458
- <pre><code class="language-bash">glotfile import --adapter laravel-php --from lang/
510
+ `,text:`Writes the locale files for every output configured in , using the adapters you've set up. Options Option Description --- --- Export only the outputs using this adapter. Re-export whenever the state file changes (stays running). , Target a different state file. Warnings Where a conversion would be lossy (a construct a target format can't represent), export prints a warning and writes the best safe output rather than corrupting the file: See Placeholders and ICU. Zero-diff guarantee Because is written deterministically, re-running with no real changes produces a zero-line diff . That makes it safe to run in CI to confirm your locale files are up to date: Tip: Prefer in CI — re-exports in memory and fails if any output file is missing or stale — no dance required. See Continuous Integration. Related - Output Formats · Placeholders and ICU · lint and check · Continuous Integration`},{id:`cli/import`,title:"`glotfile import`",section:`CLI`,html:`<h1><code>glotfile import</code></h1>
511
+ <p>The inverse of <code>glotfile export</code>: it reads your <strong>existing</strong> locale files and ingests them <em>into</em> a new <code>glotfile.json</code>, so you can onboard a project that already has translations without re-keying everything by hand.</p>
512
+ <pre><code class="language-bash">glotfile import --format laravel-php --source lang/
459
513
  </code></pre>
514
+ <p>Glotfile parses each file with the chosen adapter (the same adapters used for export, run in reverse), flattens the keys, and assembles a catalog. Existing translations land as <code>reviewed</code> (not raw machine output) and the source-locale strings as <code>source</code> — ready for review in the Editor.</p>
515
+ <h2>Options</h2>
460
516
  <table>
461
517
  <thead>
462
518
  <tr>
463
- <th>Option (planned)</th>
519
+ <th>Option</th>
464
520
  <th>Description</th>
465
521
  </tr>
466
522
  </thead>
467
523
  <tbody><tr>
468
- <td><code>--adapter &lt;name&gt;</code></td>
469
- <td>Which format to read (the same adapters used for export, run in reverse).</td>
524
+ <td><code>--format &lt;name&gt;</code></td>
525
+ <td>Source layout adapter to read (e.g. <code>laravel-php</code>, <code>flutter-arb</code>). Required.</td>
526
+ </tr>
527
+ <tr>
528
+ <td><code>--source &lt;dir&gt;</code></td>
529
+ <td>Directory to import from. Defaults to the state file&#39;s directory.</td>
530
+ </tr>
531
+ <tr>
532
+ <td><code>--source-locale &lt;code&gt;</code></td>
533
+ <td>Which locale to treat as the source language.</td>
470
534
  </tr>
471
535
  <tr>
472
- <td><code>--from &lt;dir&gt;</code></td>
473
- <td>The directory to read existing locale files from.</td>
536
+ <td><code>--locales &lt;list&gt;</code></td>
537
+ <td>Comma-separated locales to import (default: every locale found).</td>
538
+ </tr>
539
+ <tr>
540
+ <td><code>--cldr</code></td>
541
+ <td>Expand CLDR plural forms into glotfile plurals.</td>
542
+ </tr>
543
+ <tr>
544
+ <td><code>--force</code></td>
545
+ <td>Overwrite an existing <code>glotfile.json</code>.</td>
546
+ </tr>
547
+ <tr>
548
+ <td><code>--file</code>, <code>-f &lt;path&gt;</code></td>
549
+ <td>Write the catalog to a different state-file path.</td>
474
550
  </tr>
475
551
  </tbody></table>
476
- <p>Imported keys would land with appropriate states (existing translations as already-translated, not raw machine output), ready for review in the Editor.</p>
477
- <h2>AI-assisted import (future idea)</h2>
478
- <p>A further enhancement under consideration: an <strong>AI importer</strong> that reads your source language, infers each key&#39;s context, and bootstraps a richer <code>glotfile.json</code> automatically. This is exploratory and not committed.</p>
552
+ <pre><code class="language-bash">glotfile import --format flutter-arb --source lib/l10n --source-locale en
553
+ glotfile import --format gettext-po --source locale --cldr
554
+ </code></pre>
555
+ <h2>Round-trip safety</h2>
556
+ <p>Import records the <code>localeCase</code> and <code>localeMap</code> it inferred from the filenames it found, so a subsequent <code>glotfile export</code> reproduces byte-identical files. Round-trip tests assert <code>import(export(x))</code> fidelity. See Output Formats.</p>
479
557
  <h2>Related</h2>
480
558
  <ul>
481
559
  <li>export · Output Formats · Installation</li>
482
560
  </ul>
483
- `},{id:`cli/lint-and-check`,title:"`glotfile lint` and `glotfile check`",section:`CLI`,html:`<h1><code>glotfile lint</code> and <code>glotfile check</code></h1>
561
+ `,text:`The inverse of : it reads your existing locale files and ingests them into a new , so you can onboard a project that already has translations without re-keying everything by hand. Glotfile parses each file with the chosen adapter (the same adapters used for export, run in reverse), flattens the keys, and assembles a catalog. Existing translations land as (not raw machine output) and the source-locale strings as — ready for review in the Editor. Options Option Description --- --- Source layout adapter to read (e.g. , ). Required. Directory to import from. Defaults to the state file's directory. Which locale to treat as the source language. Comma-separated locales to import (default: every locale found). Expand CLDR plural forms into glotfile plurals. Overwrite an existing . , Write the catalog to a different state-file path. Round-trip safety Import records the and it inferred from the filenames it found, so a subsequent reproduces byte-identical files. Round-trip tests assert fidelity. See Output Formats. Related - export · Output Formats · Installation`},{id:`cli/lint-and-check`,title:"`glotfile lint` and `glotfile check`",section:`CLI`,html:`<h1><code>glotfile lint</code> and <code>glotfile check</code></h1>
484
562
  <p>Two related commands for finding translation problems. Both are designed to run in CI.</p>
485
563
  <ul>
486
564
  <li><strong><code>lint</code></strong> runs the rule engine against your catalog.</li>
@@ -563,7 +641,54 @@ glotfile lint --include-suppressed # audit what&#39;s hidden
563
641
  <ul>
564
642
  <li>Checks and Validation · Continuous Integration · export · Configuration Reference</li>
565
643
  </ul>
566
- `},{id:`cli/serve`,title:"`glotfile serve`",section:`CLI`,html:`<h1><code>glotfile serve</code></h1>
644
+ `,text:`and Two related commands for finding translation problems. Both are designed to run in CI. - runs the rule engine against your catalog. - runs the same rules and verifies that your exported locale files are up to date. It's the all-in-one CI gate. Exits if there are any errors , or if warnings exceed . Options Option Description --- --- Output format: (default), , or . Run only these rule ids, comma-separated. Restrict to these locales. Exit if warnings exceed (errors always fail). Also print findings hidden by suppressions, marked . Suppress every current warning (narrow with / ) and write the state file. , Target a different state file. Suppressions and A finding dismissed in the UI (or accepted here) is suppressed for that key + locale until the key's source text changes , then it resurfaces automatically. Adopting glotfile on a project with a noisy backlog: never suppresses errors, and suppressions are committed with the state file so the whole team (and CI) agrees. Info: SARIF for code scanning — emits SARIF 2.1.0 with each finding located at its line in . Upload it to GitHub code scanning to see findings inline on the PR. See Continuous Integration. does everything does, plus re-exports every output in memory and compares it to what's on disk. A missing or out-of-date file is reported as an error : It exits on any error (a lint error or a stale export), and accepts like . If itself can't be parsed, reports a single and exits . Tip: Use as your one CI step — it catches both "the catalog has problems" and "someone forgot to run " in a single command. Configuring rules Rule severities, ignored keys, and dictionaries are set in . See Checks and Validation and Configuration Reference. Related - Checks and Validation · Continuous Integration · export · Configuration Reference`},{id:`cli/prune`,title:"`glotfile prune`",section:`CLI`,html:`<h1><code>glotfile prune</code></h1>
645
+ <p>Removes keys you no longer need. It&#39;s a <strong>dry-run by default</strong> — it lists what it would remove and changes nothing until you pass <code>--write</code>.</p>
646
+ <pre><code class="language-bash">glotfile prune --unused # list keys with no code reference
647
+ glotfile prune --unused --write # actually remove them
648
+ </code></pre>
649
+ <h2>Options</h2>
650
+ <table>
651
+ <thead>
652
+ <tr>
653
+ <th>Option</th>
654
+ <th>Description</th>
655
+ </tr>
656
+ </thead>
657
+ <tbody><tr>
658
+ <td><code>--empty-source</code></td>
659
+ <td>Select keys whose source value is empty.</td>
660
+ </tr>
661
+ <tr>
662
+ <td><code>--unused</code></td>
663
+ <td>Select keys with no code reference (runs a scan first).</td>
664
+ </tr>
665
+ <tr>
666
+ <td><code>--write</code></td>
667
+ <td>Remove the selected keys. Without it, prune only lists them.</td>
668
+ </tr>
669
+ <tr>
670
+ <td><code>--file</code>, <code>-f &lt;path&gt;</code></td>
671
+ <td>Target a different state file.</td>
672
+ </tr>
673
+ </tbody></table>
674
+ <p>Pick exactly one of <code>--empty-source</code> or <code>--unused</code>. The <code>--unused</code> selector runs a fresh scan, so its accuracy depends on your <code>config.scan</code> settings — review the dry-run list before writing.</p>
675
+ <h2>Related</h2>
676
+ <ul>
677
+ <li>scan · Keys and Locales · Configuration Reference</li>
678
+ </ul>
679
+ `,text:`Removes keys you no longer need. It's a dry-run by default — it lists what it would remove and changes nothing until you pass . Options Option Description --- --- Select keys whose source value is empty. Select keys with no code reference (runs a scan first). Remove the selected keys. Without it, prune only lists them. , Target a different state file. Pick exactly one of or . The selector runs a fresh scan, so its accuracy depends on your settings — review the dry-run list before writing. Related - scan · Keys and Locales · Configuration Reference`},{id:`cli/scan`,title:"`glotfile scan`",section:`CLI`,html:`<h1><code>glotfile scan</code></h1>
680
+ <p>Scans your codebase for places each translation key is used, and writes the result to <code>.glotfile/usage.json</code> (gitignored). This usage index powers the <strong>unused-keys</strong> pruning, the per-key context builder, and the usage tree in the web UI.</p>
681
+ <pre><code class="language-bash">glotfile scan
682
+ </code></pre>
683
+ <pre><code>Scanned 214 file(s), found 1,038 reference(s).
684
+ </code></pre>
685
+ <h2>What it scans</h2>
686
+ <p>The scan walks the project and matches key references. Tune it with the <code>config.scan</code> block — <code>include</code>/<code>exclude</code> globs, extra Flutter accessor names, and custom capture-group regexes. See Configuration Reference.</p>
687
+ <h2>Related</h2>
688
+ <ul>
689
+ <li>prune · build-context · Key Context and Metadata · Configuration Reference</li>
690
+ </ul>
691
+ `,text:`Scans your codebase for places each translation key is used, and writes the result to (gitignored). This usage index powers the unused-keys pruning, the per-key context builder, and the usage tree in the web UI. What it scans The scan walks the project and matches key references. Tune it with the block — / globs, extra Flutter accessor names, and custom capture-group regexes. See Configuration Reference. Related - prune · build-context · Key Context and Metadata · Configuration Reference`},{id:`cli/serve`,title:"`glotfile serve`",section:`CLI`,html:`<h1><code>glotfile serve</code></h1>
567
692
  <p>Starts the local web UI and opens your browser. This is the <strong>default command</strong> — <code>glotfile</code> on its own does the same thing.</p>
568
693
  <pre><code class="language-bash">glotfile
569
694
  glotfile serve
@@ -595,7 +720,43 @@ glotfile serve
595
720
  <ul>
596
721
  <li>Quick Start · Web UI Overview · Installation</li>
597
722
  </ul>
598
- `},{id:`cli/translate`,title:"`glotfile translate`",section:`CLI`,html:`<h1><code>glotfile translate</code></h1>
723
+ `,text:`Starts the local web UI and opens your browser. This is the default command — on its own does the same thing. It binds a server to , prints the URL, and opens it. If there's no in the current directory, it starts from defaults and writes the file on your first edit. Options Option Description --- --- , Use a state file other than . Developer mode for working on Glotfile itself (used by ). Note: Local only — the server binds to — it is not exposed to your network. Everything stays on your machine except the AI calls you trigger. Related - Quick Start · Web UI Overview · Installation`},{id:`cli/skill`,title:"`glotfile skill`",section:`CLI`,html:`<h1><code>glotfile skill</code></h1>
724
+ <p>Installs the <strong>Claude Code skill</strong> for managing glotfile into <code>./.claude/skills/glotfile/</code>, so Claude Code knows how to drive glotfile in your project — translating, exporting, linting, and editing the catalog.</p>
725
+ <pre><code class="language-bash">glotfile skill
726
+ </code></pre>
727
+ <h2>Options</h2>
728
+ <table>
729
+ <thead>
730
+ <tr>
731
+ <th>Option</th>
732
+ <th>Description</th>
733
+ </tr>
734
+ </thead>
735
+ <tbody><tr>
736
+ <td><code>--print</code></td>
737
+ <td>Write <code>SKILL.md</code> to stdout instead of installing it.</td>
738
+ </tr>
739
+ <tr>
740
+ <td><code>--force</code></td>
741
+ <td>Overwrite an existing installed skill.</td>
742
+ </tr>
743
+ </tbody></table>
744
+ <p>Run it once per project. With the skill installed, you can ask Claude Code to manage translations directly and it will use the glotfile CLI for you.</p>
745
+ <h2>Related</h2>
746
+ <ul>
747
+ <li>CLI Overview · translate</li>
748
+ </ul>
749
+ `,text:`Installs the Claude Code skill for managing glotfile into , so Claude Code knows how to drive glotfile in your project — translating, exporting, linting, and editing the catalog. Options Option Description --- --- Write to stdout instead of installing it. Overwrite an existing installed skill. Run it once per project. With the skill installed, you can ask Claude Code to manage translations directly and it will use the glotfile CLI for you. Related - CLI Overview · translate`},{id:`cli/split`,title:"`glotfile split`",section:`CLI`,html:`<h1><code>glotfile split</code></h1>
750
+ <p>Converts a single <code>glotfile.json</code> into a <code>glotfile/</code> <strong>directory</strong> of smaller files — one per locale plus shared config and key metadata. For large catalogs this keeps <code>git diff</code> fast and reviewable: an AI run on French rewrites only <code>glotfile/locales/fr.json</code>.</p>
751
+ <pre><code class="language-bash">glotfile split
752
+ </code></pre>
753
+ <p>This is a one-time, deliberate operation that produces a clearly-labelled commit and sets <code>config.storage</code> to <code>&quot;split&quot;</code>. After splitting, the CLI, web UI, and every export adapter behave identically — only the on-disk layout changes. Load auto-detects the format, so nothing else needs configuring.</p>
754
+ <p>See The State File for the full directory layout and the trade-offs.</p>
755
+ <h2>Related</h2>
756
+ <ul>
757
+ <li>The State File · Configuration Reference</li>
758
+ </ul>
759
+ `,text:`Converts a single into a directory of smaller files — one per locale plus shared config and key metadata. For large catalogs this keeps fast and reviewable: an AI run on French rewrites only . This is a one-time, deliberate operation that produces a clearly-labelled commit and sets to . After splitting, the CLI, web UI, and every export adapter behave identically — only the on-disk layout changes. Load auto-detects the format, so nothing else needs configuring. See The State File for the full directory layout and the trade-offs. Related - The State File · Configuration Reference`},{id:`cli/translate`,title:"`glotfile translate`",section:`CLI`,html:`<h1><code>glotfile translate</code></h1>
599
760
  <p>AI-translates strings and writes the results back to <code>glotfile.json</code> as <code>machine</code> state. It never overwrites a <code>reviewed</code> value.</p>
600
761
  <pre><code class="language-bash">glotfile translate
601
762
  </code></pre>
@@ -613,8 +774,12 @@ glotfile serve
613
774
  <td>Re-translate every string, not just empty values (still never overwrites <code>reviewed</code>).</td>
614
775
  </tr>
615
776
  <tr>
777
+ <td><code>--estimate</code></td>
778
+ <td>Print the batches, token counts and estimated cost without translating.</td>
779
+ </tr>
780
+ <tr>
616
781
  <td><code>--locale &lt;list&gt;</code></td>
617
- <td>Only these target languages, comma-separated (e.g. <code>fr,de</code>).</td>
782
+ <td>Only these target languages, comma-separated (e.g. <code>fr,de</code>). Alias: <code>--locales</code>.</td>
618
783
  </tr>
619
784
  <tr>
620
785
  <td><code>--key &lt;glob&gt;</code></td>
@@ -630,6 +795,7 @@ glotfile translate --all # redo every non-reviewed value
630
795
  glotfile translate --locale fr,de # only French and German
631
796
  glotfile translate --key &quot;auth.*&quot; # only the auth namespace
632
797
  glotfile translate --all --locale fr --key &quot;checkout.*&quot;
798
+ glotfile translate --estimate # batches, tokens and cost — no API calls
633
799
  </code></pre>
634
800
  <h2>What it prints</h2>
635
801
  <pre><code>Translating 34 string(s)…
@@ -640,7 +806,7 @@ Wrote 34 machine translation(s).
640
806
  </code></pre>
641
807
  <p>See How Translation Works for the validation rules and Placeholders and ICU for what&#39;s checked.</p>
642
808
  <h2>Credentials</h2>
643
- <p><code>translate</code> is the only command that needs network access. Configure the provider in Settings or <code>config.ai</code>, and put credentials in your environment (a local <code>.env</code> works). See AI Providers.</p>
809
+ <p><code>translate</code> is the only command that needs network access. Configure the provider in Settings (stored per-machine), and put credentials in your environment (a local <code>.env</code> works). See AI Providers.</p>
644
810
  <blockquote>
645
811
  <p><strong>Info:</strong> Egress is logged — what&#39;s sent to the provider is recorded in the AI Log.</p>
646
812
  </blockquote>
@@ -648,7 +814,7 @@ Wrote 34 machine translation(s).
648
814
  <ul>
649
815
  <li>How Translation Works · AI Providers · Review States</li>
650
816
  </ul>
651
- `},{id:`concepts/glossary`,title:`Glossary`,section:`Concepts`,html:`<h1>Glossary</h1>
817
+ `,text:`AI-translates strings and writes the results back to as state. It never overwrites a value. With no flags, only empty values are filled — existing translations are left alone. Pass to re-translate every string. The flags below combine to narrow the run. Options Option Description --- --- Re-translate every string, not just empty values (still never overwrites ). Print the batches, token counts and estimated cost without translating. Only these target languages, comma-separated (e.g. ). Alias: . Only keys matching a glob (e.g. ). , Target a different state file. What it prints Rejected translations (a dropped placeholder, a busted length limit) are reported and skipped , not written: See How Translation Works for the validation rules and Placeholders and ICU for what's checked. Credentials is the only command that needs network access. Configure the provider in Settings (stored per-machine), and put credentials in your environment (a local works). See AI Providers. Info: Egress is logged — what's sent to the provider is recorded in the AI Log. Related - How Translation Works · AI Providers · Review States`},{id:`concepts/glossary`,title:`Glossary`,section:`Concepts`,html:`<h1>Glossary</h1>
652
818
  <p>The <strong>glossary</strong> is a list of terms that get special handling during AI translation and validation. It&#39;s stored at the top level of <code>glotfile.json</code> and edited in the Glossary panel.</p>
653
819
  <p>Use it for two things:</p>
654
820
  <ol>
@@ -705,7 +871,7 @@ Wrote 34 machine translation(s).
705
871
  <ul>
706
872
  <li>How Translation Works · Checks and Validation · Key Context and Metadata</li>
707
873
  </ul>
708
- `},{id:`concepts/key-context-and-metadata`,title:`Key Context and Metadata`,section:`Concepts`,html:`<h1>Key Context and Metadata</h1>
874
+ `,text:`Glossary The glossary is a list of terms that get special handling during AI translation and validation. It's stored at the top level of and edited in the Glossary panel. Use it for two things: 1. Do-not-translate terms — brand names, product names, code identifiers that must appear verbatim in every language. 2. Forced translations — a term that must always render a specific way in a given locale. Entry shape Field Meaning --- --- The source-language term to match. Keep the term verbatim in every translation. Match the term case-sensitively. Forced output per locale ( ). Freeform guidance (also passed to the AI). How it's used - During translation: relevant glossary terms for each string are injected into every AI request, so the model knows what to keep verbatim and what to render a fixed way. See How Translation Works. - During validation: the rule flags any translation that drops a do-not-translate term or doesn't use the forced translation. See Checks and Validation. Tip: Only relevant terms are sent — Glotfile matches glossary terms against each source string and includes just the ones that appear — the AI isn't handed your entire glossary for every key. Related - How Translation Works · Checks and Validation · Key Context and Metadata`},{id:`concepts/key-context-and-metadata`,title:`Key Context and Metadata`,section:`Concepts`,html:`<h1>Key Context and Metadata</h1>
709
875
  <p>Beyond its values, each key can carry metadata that improves translation quality and helps reviewers. Edit it in the Editor&#39;s per-key detail panel.</p>
710
876
  <table>
711
877
  <thead>
@@ -751,7 +917,7 @@ Wrote 34 machine translation(s).
751
917
  <ul>
752
918
  <li>Glossary · Screenshots · How Translation Works · Checks and Validation</li>
753
919
  </ul>
754
- `},{id:`concepts/keys-and-locales`,title:`Keys and Locales`,section:`Concepts`,html:`<h1>Keys and Locales</h1>
920
+ `,text:`Key Context and Metadata Beyond its values, each key can carry metadata that improves translation quality and helps reviewers. Edit it in the Editor's per-key detail panel. Field What it's for --- --- Context A note for humans and the AI explaining where/how the string is used. The single highest-leverage field for good machine translation. Notes Timestamped freeform notes — a running comment thread on the key. Tags Labels for grouping and filtering (e.g. , , ). Analytics reports coverage per tag. Max length A character budget. AI translations that exceed it are rejected, and the check flags any value over the limit. Screenshot An image showing where the string appears. Sent to vision-capable models for context. See Screenshots. Skip translate Marks a key to be excluded from translation runs (e.g. a code-like token that should never change). Why context matters most Translators — human or AI — can't see your UI. A bare string like could be a verb (open a file) or an adjective (the store is open), and they translate differently. A one-line context removes the ambiguity: Example: Key → context: "Adjective. Shown on a badge when the shop is currently accepting orders." AI translation sends the context, the relevant Glossary terms, any max length, and the screenshot along with each string. A note on The state file also reserves a field on keys. It is not yet editable in the UI — prefer context (which feeds the AI) and notes (for human discussion) today. Related - Glossary · Screenshots · How Translation Works · Checks and Validation`},{id:`concepts/keys-and-locales`,title:`Keys and Locales`,section:`Concepts`,html:`<h1>Keys and Locales</h1>
755
921
  <h2>Keys</h2>
756
922
  <p>A <strong>key</strong> is a stable identifier for one piece of copy, written in <strong>dot notation</strong>:</p>
757
923
  <pre><code>auth.signIn.button
@@ -789,7 +955,7 @@ settings.profile.heading
789
955
  <ul>
790
956
  <li>Review States · Plurals · Key Context and Metadata · The State File</li>
791
957
  </ul>
792
- `},{id:`concepts/plurals`,title:`Plurals`,section:`Concepts`,html:`<h1>Plurals</h1>
958
+ `,text:`Keys and Locales Keys A key is a stable identifier for one piece of copy, written in dot notation : Keys live in a flat map in — the dots are just naming convention, not nesting. The first segment usually acts as a namespace (a feature, screen, or file group); some export adapters split files by it (Laravel writes keys into ). Each key holds: - A value per locale (or plural forms). - A review state per locale. - Optional metadata — context, notes, tags, a max length, a screenshot, and a skip-translation flag. Create, rename, and delete keys in the Editor. Locales A locale is a language you maintain, identified by a code like , , , or . Two settings define them (Settings panel or config): - — the one language you author in. Its values have the state and are the basis for every translation. - — the full list of languages you maintain, including the source. ⚠ The source locale must be in the list — must appear in , or the file fails validation. Adding and removing Manage locales in Settings. Adding a locale gives every key an empty slot for it (which shows up as missing until filled). Languages are shown with their flag and name in the UI. Missing values A locale value is missing when it has no content for a key. Missing values are: - highlighted in the Editor (filter to missing ), - counted in Analytics, - what fills by default (see translate), - flagged by the rule in Checks and Validation. Related - Review States · Plurals · Key Context and Metadata · The State File`},{id:`concepts/plurals`,title:`Plurals`,section:`Concepts`,html:`<h1>Plurals</h1>
793
959
  <p>Some strings change shape with a count — &quot;1 file&quot; vs &quot;5 files&quot;. Glotfile models these as <strong>plural keys</strong> using the <a href="https://cldr.unicode.org/index/cldr-spec/plural-rules">CLDR plural categories</a>.</p>
794
960
  <h2>How a plural key differs</h2>
795
961
  <p>A normal key stores one <code>value</code> per locale. A <strong>plural key</strong> instead stores <strong><code>forms</code></strong> — one entry per category — and is marked with a <code>plural</code> field naming the <strong>count argument</strong>:</p>
@@ -826,7 +992,7 @@ settings.profile.heading
826
992
  <ul>
827
993
  <li>Placeholders and ICU · How Translation Works · Keys and Locales</li>
828
994
  </ul>
829
- `},{id:`concepts/review-states`,title:`Review States`,section:`Concepts`,html:`<h1>Review States</h1>
995
+ `,text:`Plurals Some strings change shape with a count — "1 file" vs "5 files". Glotfile models these as plural keys using the CLDR plural categories. How a plural key differs A normal key stores one per locale. A plural key instead stores — one entry per category — and is marked with a field naming the count argument : Plural categories The six CLDR categories are: · · · · · ⚠ is always required — every locale's plural value must include the form — it's the fallback every language has. Which of the other categories apply depends on the language (English uses / ; Polish uses / / / ). Editing plurals In the Editor, a plural key shows a dedicated form editor with one field per category that the target language actually uses. AI translation fills every required category at once and validates the result. Across export formats Plural and ICU / structure is preserved when exporting, and converted to each format's native plural mechanism where one exists. Where a target format can't represent a construct, warns rather than producing broken output. See Output Formats and Placeholders and ICU. Related - Placeholders and ICU · How Translation Works · Keys and Locales`},{id:`concepts/review-states`,title:`Review States`,section:`Concepts`,html:`<h1>Review States</h1>
830
996
  <p>Every locale value carries a <strong>state</strong> that tracks where the translation is in its lifecycle. State is per <em>value</em>, not per key — <code>fr</code> can be <code>reviewed</code> while <code>de</code> is still <code>machine</code>.</p>
831
997
  <table>
832
998
  <thead>
@@ -872,7 +1038,7 @@ settings.profile.heading
872
1038
  <ul>
873
1039
  <li>How Translation Works · Keeping Translations Fresh</li>
874
1040
  </ul>
875
- `},{id:`concepts/the-state-file`,title:"The State File — `glotfile.json`",section:`Concepts`,html:`<h1>The State File — <code>glotfile.json</code></h1>
1041
+ `,text:`Review States Every locale value carries a state that tracks where the translation is in its lifecycle. State is per value , not per key — can be while is still . State Meaning --- --- The value in your source locale. It's what everything else is translated from . Produced by AI translation and not yet reviewed by a human . A human has checked and approved it. AI translation never overwrites a value. Flagged for attention — typically because the source string changed after this translation was made (see Keeping Translations Fresh). The typical flow 1. You author a string in the source locale → . 2. AI fills the other languages → . 3. You review in the Editor and promote good ones → . 4. If the source later changes, dependent translations are marked so they don't silently drift. See Keeping Translations Fresh. Why is protected Marking a value is a promise: a human owns this translation. Glotfile honours that promise — neither nor the UI's translate action will overwrite it. To re-translate a reviewed value, change it back first. Filtering by state In the Editor, filter by missing , machine (unreviewed), needs-review , or reviewed , plus a needs-attention facet for any key with an open issue. Analytics reports translated vs reviewed percentages per locale. Related - How Translation Works · Keeping Translations Fresh`},{id:`concepts/the-state-file`,title:"The State File — `glotfile.json`",section:`Concepts`,html:`<h1>The State File — <code>glotfile.json</code></h1>
876
1042
  <p>Everything Glotfile does is derived from one file at the root of your project: <strong><code>glotfile.json</code></strong>. It holds your configuration, your glossary, and every key with its translations. You commit it alongside your code, and versioning, review, and rollback all come from git.</p>
877
1043
  <blockquote>
878
1044
  <p><strong>Tip:</strong> You normally never edit this file by hand — the web UI writes it for you. The structure below is documented so you can read diffs and understand what&#39;s stored — not so you can hand-edit it.</p>
@@ -881,7 +1047,7 @@ settings.profile.heading
881
1047
  <p>A fresh file looks like this:</p>
882
1048
  <pre><code class="language-json">{
883
1049
  &quot;$schema&quot;: &quot;https://glotfile.dev/schema/v1.json&quot;,
884
- &quot;version&quot;: 2,
1050
+ &quot;version&quot;: 1,
885
1051
  &quot;config&quot;: {
886
1052
  &quot;sourceLocale&quot;: &quot;en&quot;,
887
1053
  &quot;locales&quot;: [&quot;en&quot;],
@@ -889,7 +1055,6 @@ settings.profile.heading
889
1055
  { &quot;adapter&quot;: &quot;flutter-arb&quot;, &quot;path&quot;: &quot;lib/l10n/app_{locale}.arb&quot; },
890
1056
  { &quot;adapter&quot;: &quot;laravel-php&quot;, &quot;path&quot;: &quot;lang/{locale}/{namespace}.php&quot; }
891
1057
  ],
892
- &quot;ai&quot;: { &quot;provider&quot;: &quot;anthropic&quot;, &quot;model&quot;: &quot;claude-opus-4-8&quot;, &quot;endpoint&quot;: null, &quot;region&quot;: null, &quot;batchSize&quot;: 25 },
893
1058
  &quot;format&quot;: { &quot;indent&quot;: 2, &quot;sortKeys&quot;: true, &quot;finalNewline&quot;: true },
894
1059
  &quot;spelling&quot;: { &quot;customWords&quot;: [] }
895
1060
  },
@@ -906,11 +1071,11 @@ settings.profile.heading
906
1071
  </thead>
907
1072
  <tbody><tr>
908
1073
  <td><code>version</code></td>
909
- <td>State-file schema version (currently <code>2</code>).</td>
1074
+ <td>State-file schema version (currently <code>1</code>).</td>
910
1075
  </tr>
911
1076
  <tr>
912
1077
  <td><code>config</code></td>
913
- <td>All configuration — see Configuration Reference.</td>
1078
+ <td>All committed configuration — see Configuration Reference. AI provider settings are <strong>not</strong> here; they live in per-machine local settings (see AI Providers).</td>
914
1079
  </tr>
915
1080
  <tr>
916
1081
  <td><code>glossary</code></td>
@@ -989,8 +1154,8 @@ settings.profile.heading
989
1154
  <ul>
990
1155
  <li>Configuration Reference · Keys and Locales · Review States</li>
991
1156
  </ul>
992
- `},{id:`ai-translation/ai-providers`,title:`AI Providers`,section:`AI Translation`,html:`<h1>AI Providers</h1>
993
- <p>Glotfile translates via <strong>one provider at a time</strong>, chosen by <code>config.ai.provider</code>. To switch, edit that block in Settings (or <code>glotfile.json</code>) and re-run translate. Credentials are read from the environment, including a local <code>.env</code> file in the project directory.</p>
1157
+ `,text:`The State File — Everything Glotfile does is derived from one file at the root of your project: . It holds your configuration, your glossary, and every key with its translations. You commit it alongside your code, and versioning, review, and rollback all come from git. Tip: You normally never edit this file by hand — the web UI writes it for you. The structure below is documented so you can read diffs and understand what's stored — not so you can hand-edit it. Anatomy A fresh file looks like this: Field Purpose --- --- State-file schema version (currently ). All committed configuration — see Configuration Reference. AI provider settings are not here; they live in per-machine local settings (see AI Providers). Do-not-translate terms and forced per-locale translations — see Glossary. A flat map of dot-notation keys to their values and metadata — see Keys and Locales. A populated key Each locale carries a (or for plural keys), a state, and an optional recording the source string it was translated from (used to detect stale translations). Deterministic writes Glotfile writes the file deterministically — stable key order, fixed indent, one trailing newline — so git diffs stay small and reviewable. The block controls this: - — spaces per level (default ) - — sort keys alphabetically (default ) - — end with a single newline (default ) Info: Why this matters — because writes are deterministic, re-running with no real changes produces a zero-line diff . That's what makes Glotfile safe to run in CI. On load When Glotfile reads the file it validates the structure (see Checks and Validation) and normalises values — for example, trimming surrounding whitespace — so legacy data folds to the same shape the UI produces on save. A malformed file fails loudly with a specific message rather than corrupting silently. Split storage: the directory For large catalogs, a single can reach several megabytes — making slow, overflowing GitHub's render limit, and producing noisy conflicts when multiple branches add keys. The split layout breaks the catalog into a directory of smaller files, one per locale. Run once to convert an existing single file: - holds the configuration and glossary — the parts that change rarely. - holds per-key metadata (tags, notes, context, plural config, screenshots) but not translation values. A tag edit touches only this file. - holds all translation values for one locale. An AI run on French rewrites only . What controls the layout A field in the config selects how the catalog is saved: Value Behaviour --- --- (or absent) Write a single — the default for new projects. Write the directory. Set automatically by . Load auto-detects: Glotfile checks for first (split), then (single), then starts from defaults. You never need to set this by hand — sets it for you. Promotion is an explicit commit There is no silent auto-promotion at a size threshold. Running is a deliberate, one-time operation that produces a clearly-labelled commit. Once split, the CLI, web UI, and all export adapters work identically to the single-file layout — the in-memory state is unchanged. Related - Configuration Reference · Keys and Locales · Review States`},{id:`ai-translation/ai-providers`,title:`AI Providers`,section:`AI Translation`,html:`<h1>AI Providers</h1>
1158
+ <p>Glotfile translates via <strong>one provider at a time</strong>, chosen by the <code>ai.provider</code> setting. These AI settings are <strong>per-machine</strong> — they live in <code>.glotfile/settings.json</code> (gitignored), not in the committed <code>glotfile.json</code>, so each developer can use their own provider and model. Edit them in Settings and re-run translate. Credentials are read from the environment, including a local <code>.env</code> file in the project directory.</p>
994
1159
  <h2>Supported providers</h2>
995
1160
  <table>
996
1161
  <thead>
@@ -1006,35 +1171,35 @@ settings.profile.heading
1006
1171
  <td><strong>Anthropic</strong> (default)</td>
1007
1172
  <td><code>anthropic</code></td>
1008
1173
  <td><code>ANTHROPIC_API_KEY</code></td>
1009
- <td><code>config.ai.endpoint</code> (base URL)</td>
1174
+ <td><code>endpoint</code> (base URL)</td>
1010
1175
  <td>bundled (<code>@anthropic-ai/sdk</code>)</td>
1011
1176
  </tr>
1012
1177
  <tr>
1013
1178
  <td><strong>OpenAI</strong></td>
1014
1179
  <td><code>openai</code></td>
1015
1180
  <td><code>OPENAI_API_KEY</code></td>
1016
- <td><code>config.ai.endpoint</code> (base URL; also reaches any OpenAI-compatible gateway)</td>
1181
+ <td><code>endpoint</code> (base URL; also reaches any OpenAI-compatible gateway)</td>
1017
1182
  <td>optional — <code>npm i openai</code></td>
1018
1183
  </tr>
1019
1184
  <tr>
1020
1185
  <td><strong>AWS Bedrock</strong></td>
1021
1186
  <td><code>bedrock</code></td>
1022
1187
  <td>standard AWS chain: <code>AWS_ACCESS_KEY_ID</code> / <code>AWS_SECRET_ACCESS_KEY</code> (/ <code>AWS_SESSION_TOKEN</code>), or <code>AWS_PROFILE</code>, or an SSO / instance role</td>
1023
- <td><code>config.ai.region</code> (falls back to <code>AWS_REGION</code>)</td>
1188
+ <td><code>region</code> (falls back to <code>AWS_REGION</code>)</td>
1024
1189
  <td>optional — <code>npm i @aws-sdk/client-bedrock-runtime</code></td>
1025
1190
  </tr>
1026
1191
  <tr>
1027
1192
  <td><strong>OpenRouter</strong></td>
1028
1193
  <td><code>openrouter</code></td>
1029
1194
  <td><code>OPENROUTER_API_KEY</code></td>
1030
- <td><code>config.ai.endpoint</code> (base URL; defaults to <code>https://openrouter.ai/api/v1</code>)</td>
1195
+ <td><code>endpoint</code> (base URL; defaults to <code>https://openrouter.ai/api/v1</code>)</td>
1031
1196
  <td>optional — <code>npm i openai</code> (OpenAI-compatible)</td>
1032
1197
  </tr>
1033
1198
  <tr>
1034
1199
  <td><strong>Ollama</strong> (local)</td>
1035
1200
  <td><code>ollama</code></td>
1036
1201
  <td>none for local; <code>OLLAMA_API_KEY</code> only for a secured / remote server</td>
1037
- <td><code>config.ai.endpoint</code> (base URL; defaults to <code>http://localhost:11434/v1</code>)</td>
1202
+ <td><code>endpoint</code> (base URL; defaults to <code>http://localhost:11434/v1</code>)</td>
1038
1203
  <td>optional — <code>npm i openai</code> (OpenAI-compatible)</td>
1039
1204
  </tr>
1040
1205
  <tr>
@@ -1048,8 +1213,9 @@ settings.profile.heading
1048
1213
  <blockquote>
1049
1214
  <p><strong>Info:</strong> Optional SDKs load on demand — the OpenAI SDK (also used by OpenRouter) and the AWS SDK are optional dependencies, loaded only when their provider is selected — so a default install stays small. If the SDK is missing when you translate, Glotfile tells you exactly what to install.</p>
1050
1215
  </blockquote>
1051
- <h2><code>config.ai</code></h2>
1052
- <pre><code class="language-json">&quot;ai&quot;: { &quot;provider&quot;: &quot;anthropic&quot;, &quot;model&quot;: &quot;claude-opus-4-8&quot;, &quot;endpoint&quot;: null, &quot;region&quot;: null, &quot;batchSize&quot;: 25 }
1216
+ <h2>The <code>ai</code> settings</h2>
1217
+ <p>Stored per-machine in <code>.glotfile/settings.json</code> (gitignored). The default:</p>
1218
+ <pre><code class="language-json">&quot;ai&quot;: { &quot;provider&quot;: &quot;anthropic&quot;, &quot;model&quot;: &quot;claude-sonnet-4-6&quot;, &quot;endpoint&quot;: null, &quot;region&quot;: null, &quot;batchSize&quot;: 25 }
1053
1219
  </code></pre>
1054
1220
  <table>
1055
1221
  <thead>
@@ -1143,7 +1309,7 @@ settings.profile.heading
1143
1309
  <ul>
1144
1310
  <li>How Translation Works · translate · Settings · AI Log</li>
1145
1311
  </ul>
1146
- `},{id:`ai-translation/how-translation-works`,title:`How Translation Works`,section:`AI Translation`,html:`<h1>How Translation Works</h1>
1312
+ `,text:`AI Providers Glotfile translates via one provider at a time , chosen by the setting. These AI settings are per-machine — they live in (gitignored), not in the committed , so each developer can use their own provider and model. Edit them in Settings and re-run translate. Credentials are read from the environment, including a local file in the project directory. Supported providers Provider Credentials Region / endpoint SDK --- --- --- --- --- Anthropic (default) (base URL) bundled ( ) OpenAI (base URL; also reaches any OpenAI-compatible gateway) optional — AWS Bedrock standard AWS chain: / (/ ), or , or an SSO / instance role (falls back to ) optional — OpenRouter (base URL; defaults to ) optional — (OpenAI-compatible) Ollama (local) none for local; only for a secured / remote server (base URL; defaults to ) optional — (OpenAI-compatible) Claude Code (local) none — uses your local Claude Code session n/a none — spawns the CLI Info: Optional SDKs load on demand — the OpenAI SDK (also used by OpenRouter) and the AWS SDK are optional dependencies, loaded only when their provider is selected — so a default install stays small. If the SDK is missing when you translate, Glotfile tells you exactly what to install. The settings Stored per-machine in (gitignored). The default: Field Meaning --- --- , , , , , or . The model id for the chosen provider. Base URL override (Anthropic / OpenAI / OpenRouter / Ollama). for the provider default — OpenRouter defaults to , Ollama to . An overridden Ollama endpoint must include the suffix. AWS region (Bedrock). Falls back to . Strings per request (default ). Examples OpenAI: OpenRouter (OpenAI-compatible; uses namespaced model ids): Ollama (local, OpenAI-compatible; no key needed — start Ollama and the model first): Claude Code (uses your local Claude Code session; no API key needed): AWS Bedrock — Amazon Nova: AWS Bedrock — Claude or Meta Llama (same provider, different model id): Vision (screenshots) Keys with a screenshot are sent to vision-capable models for context: Model family Vision --- --- Anthropic ✅ OpenAI (gpt-4o-class) ✅ Bedrock — Amazon Nova / Claude ✅ Bedrock — Meta Llama (text) ❌ — runs text-only, warns how many screenshots were skipped OpenRouter ✅ for vision-capable models (e.g. , , ); a text-only model ignores the image Ollama ❌ — runs text-only (most local models can't see images); screenshots are skipped Claude Code ❌ — runs text-only via the CLI subprocess; screenshots are skipped Data residency AI translation is the only path by which source strings leave your boundary. To keep strings in-region, pin AWS Bedrock to a region , or point the Anthropic / OpenAI at an in-region or self-hosted gateway. For the strongest guarantee, run Ollama locally — strings never leave the machine. Note that OpenRouter routes your strings through its service to the upstream model provider you select — avoid it where data residency is a hard requirement. No credentials are ever written to or logged. Related - How Translation Works · translate · Settings · AI Log`},{id:`ai-translation/how-translation-works`,title:`How Translation Works`,section:`AI Translation`,html:`<h1>How Translation Works</h1>
1147
1313
  <p>AI translation is the only feature that needs network access or credentials — everything else in Glotfile works offline. You can trigger it from the Editor or with <code>glotfile translate</code>; both use the same engine.</p>
1148
1314
  <h2>What gets sent</h2>
1149
1315
  <p>For each string that needs translating, Glotfile sends the provider:</p>
@@ -1155,7 +1321,7 @@ settings.profile.heading
1155
1321
  <li>any <strong>max length</strong>, and</li>
1156
1322
  <li>for vision-capable models, the key&#39;s <strong>screenshot</strong>.</li>
1157
1323
  </ul>
1158
- <p>Strings are sent in batches (<code>config.ai.batchSize</code>, default 25).</p>
1324
+ <p>Strings are sent in batches (the <code>ai.batchSize</code> setting, default 25).</p>
1159
1325
  <h2>Validation on the way back</h2>
1160
1326
  <p>A translation is only written if it passes validation:</p>
1161
1327
  <ul>
@@ -1182,7 +1348,7 @@ settings.profile.heading
1182
1348
  <ul>
1183
1349
  <li>AI Providers · Glossary · Placeholders and ICU · AI Log</li>
1184
1350
  </ul>
1185
- `},{id:`reference/checks-and-validation`,title:`Checks and Validation`,section:`Reference`,html:`<h1>Checks and Validation</h1>
1351
+ `,text:`How Translation Works AI translation is the only feature that needs network access or credentials — everything else in Glotfile works offline. You can trigger it from the Editor or with ; both use the same engine. What gets sent For each string that needs translating, Glotfile sends the provider: - the source string (or plural forms), - the key's context , - the relevant Glossary terms (only those that appear in the string), - the target locale , - any max length , and - for vision-capable models, the key's screenshot . Strings are sent in batches (the setting, default 25). Validation on the way back A translation is only written if it passes validation: - Placeholders must match the source — a translation that drops or renames , , , etc. is rejected . See Placeholders and ICU. - ICU plural/select structure must be preserved. - Max length , if set, must not be exceeded. Rejected translations are reported and skipped, not written: What it writes - Accepted translations are written as state. - A value is never overwritten — your human edits are safe. - The source string each translation was made from is recorded, so later source edits can flag the translation as stale. Vision and model fit Screenshots are sent only to models that can see them. For models that can't (e.g. Bedrock Meta Llama text models), the run proceeds text-only and prints how many screenshots were skipped — so any model still works. See AI Providers for the support matrix. Privacy ⚠ What leaves your machine — AI translation is the only path by which your source strings leave your boundary. No credentials are ever written to or the AI Log. To keep strings in-region, pin a Bedrock region or point an Anthropic/OpenAI endpoint at an in-region gateway — see AI Providers. Related - AI Providers · Glossary · Placeholders and ICU · AI Log`},{id:`reference/checks-and-validation`,title:`Checks and Validation`,section:`Reference`,html:`<h1>Checks and Validation</h1>
1186
1352
  <p>Glotfile validates your catalog two ways: <strong>live in the UI</strong> as you edit, and via the <strong><code>lint</code> / <code>check</code></strong> commands for CI. Both look for the same kinds of problem.</p>
1187
1353
  <h2>Lint rules</h2>
1188
1354
  <p><code>glotfile lint</code> runs these rules. Each has a default severity you can override in <code>config.lint.rules</code>.</p>
@@ -1307,15 +1473,17 @@ settings.profile.heading
1307
1473
  <ul>
1308
1474
  <li>lint and check · Continuous Integration · Placeholders and ICU · Configuration Reference</li>
1309
1475
  </ul>
1310
- `},{id:`reference/configuration-reference`,title:`Configuration Reference`,section:`Reference`,html:`<h1>Configuration Reference</h1>
1311
- <p>Every field in the <code>config</code> block of <code>glotfile.json</code>. Edit these in Settings rather than by hand where you can.</p>
1476
+ `,text:`Checks and Validation Glotfile validates your catalog two ways: live in the UI as you edit, and via the / commands for CI. Both look for the same kinds of problem. Lint rules runs these rules. Each has a default severity you can override in . Rule id Default Catches --- --- --- error A key whose source value is empty. error A target value that's missing or whitespace-only. error Translation placeholders differ from the source. error One side is an ICU plural/select and the other isn't. error A do-not-translate term is altered, or a forced Glossary translation is missing. warn A value longer than the key's max length. warn A translation identical to the source string. warn Leading/trailing whitespace that differs from the source. warn A word the locale's dictionary doesn't recognise. adds one more, by re-exporting and comparing to disk: Rule id Default Catches --- --- --- error An exported file is missing or out of date — run . Configuring rules — Editable in Settings → Quality checks , or by hand: Field Meaning --- --- Override a rule's severity: , , or . Globs of keys to skip entirely. Map a locale to a different dictionary id (e.g. use the dictionary for ). Rule configuration applies everywhere at once: the live editor checks, the Analytics release gate, and / . The rule accepts Glossary terms and the custom dictionary ( ) automatically. Note: Spelling needs a dictionary — the rule only runs for locales that have a dictionary available. Locales without one are skipped with a notice. Dismissing a single finding Sometimes a warning is just wrong for one string — "Logo" really is "Logo" in French. Dismiss the finding from Analytics (or the key's detail panel) and it's suppressed for that key + locale until the source text changes , at which point it resurfaces automatically. Suppressions are stored on the key in the state file, so they're shared with your team and reviewable in diffs. - bulk-suppresses the current warnings — useful when adopting glotfile on an existing project. - shows suppressed findings (marked); Analytics has a matching "Suppressed (n)" drawer with per-finding restore. - Errors are never bulk-accepted; fix those instead. Severities and exit codes - error → fails / (exit ). - warn → reported; fails only if over . - off → not run. See lint and check for (text / json / sarif), , , and , and Continuous Integration for wiring it up. Live UI checks The Editor continuously surfaces issues — missing values, placeholder mismatches, length and glossary violations, and spelling — so you fix them as you work. The needs-attention filter shows every key with an open issue. Related - lint and check · Continuous Integration · Placeholders and ICU · Configuration Reference`},{id:`reference/configuration-reference`,title:`Configuration Reference`,section:`Reference`,html:`<h1>Configuration Reference</h1>
1477
+ <p>Every field in the <code>config</code> block of <code>glotfile.json</code> — the configuration you <strong>commit</strong> alongside your code. Edit these in Settings rather than by hand where you can.</p>
1478
+ <blockquote>
1479
+ <p><strong>Info:</strong> AI provider settings are <strong>not</strong> part of this committed config. They&#39;re per-machine and live in <code>.glotfile/settings.json</code> (gitignored) — see AI Providers.</p>
1480
+ </blockquote>
1312
1481
  <pre><code class="language-json">&quot;config&quot;: {
1313
1482
  &quot;sourceLocale&quot;: &quot;en&quot;,
1314
1483
  &quot;locales&quot;: [&quot;en&quot;, &quot;fr&quot;, &quot;de&quot;],
1315
1484
  &quot;outputs&quot;: [
1316
1485
  { &quot;adapter&quot;: &quot;flutter-arb&quot;, &quot;path&quot;: &quot;lib/l10n/app_{locale}.arb&quot; }
1317
1486
  ],
1318
- &quot;ai&quot;: { &quot;provider&quot;: &quot;anthropic&quot;, &quot;model&quot;: &quot;claude-opus-4-8&quot;, &quot;endpoint&quot;: null, &quot;region&quot;: null, &quot;batchSize&quot;: 25 },
1319
1487
  &quot;format&quot;: { &quot;indent&quot;: 2, &quot;sortKeys&quot;: true, &quot;finalNewline&quot;: true },
1320
1488
  &quot;spelling&quot;: { &quot;customWords&quot;: [] },
1321
1489
  &quot;lint&quot;: { &quot;rules&quot;: {}, &quot;ignore&quot;: [], &quot;spelling&quot;: { &quot;locales&quot;: {} } }
@@ -1353,7 +1521,7 @@ settings.profile.heading
1353
1521
  <tr>
1354
1522
  <td><code>localeCase</code></td>
1355
1523
  <td><code>&quot;lower-hyphen&quot;</code> | <code>&quot;lower-underscore&quot;</code> | <code>&quot;bcp47-hyphen&quot;</code> | <code>&quot;bcp47-underscore&quot;</code> | null</td>
1356
- <td>Locale-code rendering style for this output. Default: the adapter&#39;s own convention (<code>bcp47-underscore</code> for ARB, <code>lower-hyphen</code> for all others). Applies to the <code>{locale}</code> path token and any in-file locale token.</td>
1524
+ <td>Locale-code rendering style for this output. Default: the adapter&#39;s own convention (<code>bcp47-underscore</code> for ARB; <code>bcp47-hyphen</code> for <code>angular-xliff</code>, <code>rails-yaml</code> and <code>apple-strings</code>; <code>lower-hyphen</code> for all others). Applies to the <code>{locale}</code> path token and any in-file locale token.</td>
1357
1525
  </tr>
1358
1526
  <tr>
1359
1527
  <td><code>localeMap</code></td>
@@ -1361,42 +1529,9 @@ settings.profile.heading
1361
1529
  <td>Per-locale override that wins over <code>localeCase</code>. Keys are canonical (lowercase-hyphen) codes and must be locales in <code>config.locales</code>. E.g. <code>{ &quot;zh-hant&quot;: &quot;zh_HK&quot; }</code>.</td>
1362
1530
  </tr>
1363
1531
  </tbody></table>
1364
- <h2><code>ai</code> (object, required)</h2>
1365
- <p>Translation provider settings — full detail in AI Providers.</p>
1366
- <table>
1367
- <thead>
1368
- <tr>
1369
- <th>Field</th>
1370
- <th>Type</th>
1371
- <th>Default</th>
1372
- </tr>
1373
- </thead>
1374
- <tbody><tr>
1375
- <td><code>provider</code></td>
1376
- <td><code>anthropic</code> | <code>openai</code> | <code>bedrock</code></td>
1377
- <td><code>anthropic</code></td>
1378
- </tr>
1379
- <tr>
1380
- <td><code>model</code></td>
1381
- <td>string</td>
1382
- <td><code>claude-opus-4-8</code></td>
1383
- </tr>
1384
- <tr>
1385
- <td><code>endpoint</code></td>
1386
- <td>string | null</td>
1387
- <td><code>null</code></td>
1388
- </tr>
1389
- <tr>
1390
- <td><code>region</code></td>
1391
- <td>string | null</td>
1392
- <td><code>null</code></td>
1393
- </tr>
1394
- <tr>
1395
- <td><code>batchSize</code></td>
1396
- <td>number</td>
1397
- <td><code>25</code></td>
1398
- </tr>
1399
- </tbody></table>
1532
+ <blockquote>
1533
+ <p><strong>Info:</strong> AI provider settings — <code>provider</code>, <code>model</code>, <code>endpoint</code>, <code>region</code>, <code>batchSize</code> — are <strong>not</strong> in <code>config</code>. They&#39;re per-machine local settings; see AI Providers.</p>
1534
+ </blockquote>
1400
1535
  <h2><code>format</code> (object, required)</h2>
1401
1536
  <p>Controls how <code>glotfile.json</code> is written — keeps diffs small. See The State File.</p>
1402
1537
  <table>
@@ -1464,6 +1599,43 @@ settings.profile.heading
1464
1599
  <td>Use a specific dictionary for a locale.</td>
1465
1600
  </tr>
1466
1601
  </tbody></table>
1602
+ <h2><code>scan</code> (object, optional)</h2>
1603
+ <p>Tunes the codebase scan that powers usage detection and unused-key pruning. See scan.</p>
1604
+ <table>
1605
+ <thead>
1606
+ <tr>
1607
+ <th>Field</th>
1608
+ <th>Type</th>
1609
+ <th>Meaning</th>
1610
+ </tr>
1611
+ </thead>
1612
+ <tbody><tr>
1613
+ <td><code>include</code></td>
1614
+ <td>string[]</td>
1615
+ <td>Globs of files to scan.</td>
1616
+ </tr>
1617
+ <tr>
1618
+ <td><code>exclude</code></td>
1619
+ <td>string[]</td>
1620
+ <td>Globs to skip.</td>
1621
+ </tr>
1622
+ <tr>
1623
+ <td><code>accessors</code></td>
1624
+ <td>string[]</td>
1625
+ <td>Extra Flutter accessor names the <code>gen_l10n</code> object is bound to (auto-detection covers most projects; this is the escape hatch).</td>
1626
+ </tr>
1627
+ <tr>
1628
+ <td><code>patterns</code></td>
1629
+ <td>string[]</td>
1630
+ <td>Custom usage-scan regexes (capture group 1 = the key) applied to every file.</td>
1631
+ </tr>
1632
+ </tbody></table>
1633
+ <h2><code>autoExport</code> (boolean, optional)</h2>
1634
+ <p>When <code>true</code> (the default), <code>glotfile serve</code> re-exports the locale files to disk on every change. Set <code>false</code> to write only on an explicit <code>glotfile export</code>.</p>
1635
+ <h2><code>exportLocales</code> (string[], optional)</h2>
1636
+ <p>An allow-list narrowing which locales every export writes. Empty or absent means export all of <code>locales</code>. Persisted so the serve auto-export hook honours it too.</p>
1637
+ <h2><code>storage</code> (<code>&quot;single&quot;</code> | <code>&quot;split&quot;</code>, optional)</h2>
1638
+ <p>On-disk layout. Absent or <code>&quot;single&quot;</code> keeps the monolithic <code>glotfile.json</code>; <code>&quot;split&quot;</code> persists the catalog as a <code>glotfile/</code> directory of per-locale files. Set automatically by <code>glotfile split</code> — see The State File.</p>
1467
1639
  <blockquote>
1468
1640
  <p><strong>⚠ Validation on load</strong> — Glotfile validates the whole file when it loads. A bad <code>sourceLocale</code>, an unknown rule id, a plural key missing its <code>other</code> form, or a malformed value fails with a specific message rather than corrupting data.</p>
1469
1641
  </blockquote>
@@ -1471,7 +1643,7 @@ settings.profile.heading
1471
1643
  <ul>
1472
1644
  <li>The State File · Output Formats · AI Providers · Checks and Validation</li>
1473
1645
  </ul>
1474
- `},{id:`reference/output-formats`,title:`Output Formats`,section:`Reference`,html:`<h1>Output Formats</h1>
1646
+ `,text:`Configuration Reference Every field in the block of — the configuration you commit alongside your code. Edit these in Settings rather than by hand where you can. Info: AI provider settings are not part of this committed config. They're per-machine and live in (gitignored) — see AI Providers. (string, required) The language you author in. Must be one of . See Keys and Locales. (string[], required) Every language you maintain, including the source. See Keys and Locales. (array, required) Export targets. Each entry: Field Type Meaning --- --- --- string One of the adapters. string Path template with / . string? Adapter-specific layout option (e.g. ). \\ \\ \\ \\ null Locale-code rendering style for this output. Default: the adapter's own convention ( for ARB; for , and ; for all others). Applies to the path token and any in-file locale token. \\ null Per-locale override that wins over . Keys are canonical (lowercase-hyphen) codes and must be locales in . E.g. . Info: AI provider settings — , , , , — are not in . They're per-machine local settings; see AI Providers. (object, required) Controls how is written — keeps diffs small. See The State File. Field Type Default --- --- --- number boolean boolean (object, optional) Field Type Meaning --- --- --- string[] Words the spelling check always accepts. (object, optional) Tune the validation rules (Settings → Quality checks in the UI). The spelling rule accepts Glossary terms and automatically. Field Type Meaning --- --- --- Per-rule severity overrides. string[] Key globs to skip. Use a specific dictionary for a locale. (object, optional) Tunes the codebase scan that powers usage detection and unused-key pruning. See scan. Field Type Meaning --- --- --- string[] Globs of files to scan. string[] Globs to skip. string[] Extra Flutter accessor names the object is bound to (auto-detection covers most projects; this is the escape hatch). string[] Custom usage-scan regexes (capture group 1 = the key) applied to every file. (boolean, optional) When (the default), re-exports the locale files to disk on every change. Set to write only on an explicit . (string[], optional) An allow-list narrowing which locales every export writes. Empty or absent means export all of . Persisted so the serve auto-export hook honours it too. ( , optional) On-disk layout. Absent or keeps the monolithic ; persists the catalog as a directory of per-locale files. Set automatically by — see The State File. ⚠ Validation on load — Glotfile validates the whole file when it loads. A bad , an unknown rule id, a plural key missing its form, or a malformed value fails with a specific message rather than corrupting data. Related - The State File · Output Formats · AI Providers · Checks and Validation`},{id:`reference/output-formats`,title:`Output Formats`,section:`Reference`,html:`<h1>Output Formats</h1>
1475
1647
  <p>Glotfile exports your catalog to the locale formats your apps consume. You configure outputs in <code>config.outputs</code> (via Settings or the file); each entry names an <strong>adapter</strong> and a <strong>path template</strong>. <code>glotfile export</code> writes them all.</p>
1476
1648
  <pre><code class="language-json">&quot;outputs&quot;: [
1477
1649
  { &quot;adapter&quot;: &quot;flutter-arb&quot;, &quot;path&quot;: &quot;lib/l10n/app_{locale}.arb&quot; },
@@ -1520,8 +1692,14 @@ settings.profile.heading
1520
1692
  <td>one per locale</td>
1521
1693
  </tr>
1522
1694
  <tr>
1695
+ <td><code>apple-strings</code></td>
1696
+ <td>Apple <code>.strings</code></td>
1697
+ <td>printf</td>
1698
+ <td>one per locale</td>
1699
+ </tr>
1700
+ <tr>
1523
1701
  <td><code>apple-stringsdict</code></td>
1524
- <td>Apple <code>.stringsdict</code></td>
1702
+ <td>Apple <code>.stringsdict</code> (plurals)</td>
1525
1703
  <td>printf</td>
1526
1704
  <td>one per locale</td>
1527
1705
  </tr>
@@ -1548,7 +1726,7 @@ settings.profile.heading
1548
1726
  <p><strong>Example:</strong> How <code>{namespace}</code> works — with <code>laravel-php</code> and path <code>lang/{locale}/{namespace}.php</code>, the key <code>auth.signIn.button</code> is written as <code>signIn.button</code> inside <code>lang/fr/auth.php</code>. Keys with no dot fall into a <code>messages</code> namespace.</p>
1549
1727
  </blockquote>
1550
1728
  <h2>Locale code rendering</h2>
1551
- <p>By default each adapter renders locale codes in its own convention: <code>flutter-arb</code> uses BCP-47 with underscores (<code>en_US</code>, <code>zh_Hant_TW</code>); <code>angular-xliff</code> and <code>rails-yaml</code> use BCP-47 with hyphens (<code>en-US</code>, <code>pt-BR</code>); every other adapter uses glotfile&#39;s internal lowercase-hyphen form (<code>en-us</code>).</p>
1729
+ <p>By default each adapter renders locale codes in its own convention: <code>flutter-arb</code> uses BCP-47 with underscores (<code>en_US</code>, <code>zh_Hant_TW</code>); <code>angular-xliff</code>, <code>rails-yaml</code> and <code>apple-strings</code> use BCP-47 with hyphens (<code>en-US</code>, <code>pt-BR</code>); every other adapter uses glotfile&#39;s internal lowercase-hyphen form (<code>en-us</code>).</p>
1552
1730
  <h3><code>localeCase</code></h3>
1553
1731
  <p>The optional <code>localeCase</code> field on an output entry overrides the adapter default for <strong>all</strong> locales in that output:</p>
1554
1732
  <table>
@@ -1595,14 +1773,12 @@ settings.profile.heading
1595
1773
  <h2>Lossless where possible, loud where not</h2>
1596
1774
  <p>Placeholders and ICU <code>plural</code>/<code>select</code> structure are <strong>preserved</strong> and converted to each format&#39;s native mechanism. Where a conversion would be lossy, <code>glotfile export</code> emits a <strong>warning</strong> and writes safe output rather than corrupting the file. See Placeholders and ICU.</p>
1597
1775
  <h2>Round-tripping (import)</h2>
1598
- <blockquote>
1599
- <p><strong>Info:</strong> 🚧 Coming soon — <code>glotfile import</code> will read existing files back into the catalog using these same adapters in reverse.</p>
1600
- </blockquote>
1776
+ <p><code>glotfile import</code> reads existing files back into the catalog using these same adapters in reverse — inferring <code>localeCase</code>/<code>localeMap</code> from the filenames so a later export reproduces them byte-for-byte. See import.</p>
1601
1777
  <h2>Related</h2>
1602
1778
  <ul>
1603
1779
  <li>export · Placeholders and ICU · Plurals · Configuration Reference</li>
1604
1780
  </ul>
1605
- `},{id:`reference/placeholders-and-icu`,title:`Placeholders and ICU`,section:`Reference`,html:`<h1>Placeholders and ICU</h1>
1781
+ `,text:`Output Formats Glotfile exports your catalog to the locale formats your apps consume. You configure outputs in (via Settings or the file); each entry names an adapter and a path template . writes them all. Adapters Adapter Target Placeholder style Files written --- --- --- --- Flutter ICU one per locale Laravel arrays one per locale per namespace i18next / generic JSON one per locale Vue I18n JSON one per locale gettext printf ( ) one per locale Apple printf one per locale Apple (plurals) printf one per locale Angular XLIFF 1.2 ( ) one per locale Rails i18n one per locale Path templates Two tokens are substituted in : - — the locale code ( , , …). Used by every adapter. - — the first dot-segment of the key. Used by adapters that split files by namespace. Example: How works — with and path , the key is written as inside . Keys with no dot fall into a namespace. Locale code rendering By default each adapter renders locale codes in its own convention: uses BCP-47 with underscores ( , ); , and use BCP-47 with hyphens ( , ); every other adapter uses glotfile's internal lowercase-hyphen form ( ). The optional field on an output entry overrides the adapter default for all locales in that output: Value Example --- --- , , , , applies to the filename token and any in-file locale token (ARB , gettext , XLIFF ). The optional field maps individual canonical locale codes to exact export tokens, overriding for those locales: Keys are canonical (lowercase-hyphen) codes and must be locales present in . Use for semantic remaps that no style can express — for example, Flutter rejects script subtags so must ship as ; Android requires . ⚠ Locale collision — if two locales resolve to the same export token after applying and , emits a warning and writes only the first locale's file (in config order), skipping the colliding ones rather than silently overwriting. Round-trip safety sets and automatically: it inspects the filenames it finds, picks the that reproduces them, and records only the exceptions in . A subsequent produces byte-identical files. The option Some adapters accept an optional to tune their output. For example, supports a flat layout: (Without , JSON adapters nest keys by their dot segments.) Lossless where possible, loud where not Placeholders and ICU / structure are preserved and converted to each format's native mechanism. Where a conversion would be lossy, emits a warning and writes safe output rather than corrupting the file. See Placeholders and ICU. Round-tripping (import) reads existing files back into the catalog using these same adapters in reverse — inferring / from the filenames so a later export reproduces them byte-for-byte. See import. Related - export · Placeholders and ICU · Plurals · Configuration Reference`},{id:`reference/placeholders-and-icu`,title:`Placeholders and ICU`,section:`Reference`,html:`<h1>Placeholders and ICU</h1>
1606
1782
  <p>Translations must keep the machinery the source string carries: <strong>interpolation placeholders</strong> and <strong>ICU plural/select</strong> structure. Glotfile protects both during translation, validation, and export.</p>
1607
1783
  <h2>One canonical form, converted on export</h2>
1608
1784
  <p>Glotfile stores every placeholder in a single <strong>canonical</strong> form — <code>{name}</code> —
@@ -1717,7 +1893,7 @@ round-trip.</p>
1717
1893
  <ul>
1718
1894
  <li>Plurals · Output Formats · Checks and Validation · How Translation Works</li>
1719
1895
  </ul>
1720
- `},{id:`guides/continuous-integration`,title:`Continuous Integration`,section:`Guides`,html:`<h1>Continuous Integration</h1>
1896
+ `,text:`Placeholders and ICU Translations must keep the machinery the source string carries: interpolation placeholders and ICU plural/select structure. Glotfile protects both during translation, validation, and export. One canonical form, converted on export Glotfile stores every placeholder in a single canonical form — — no matter what style the source file used. Import normalises to it; export converts it to each adapter's native style. So you edit and validate against one syntax, and each output file still gets the flavour its framework expects. Format Native style Example On import → stored On export ← stored --- --- --- --- --- Flutter ARB ICU named (already canonical) Vue I18n single braces (already canonical) Laravel colon Rails YAML percent-brace i18next double braces Angular XLIFF placeholder element A translation that drops, renames, or adds a placeholder relative to the source is: - rejected by AI translation (not written), and - flagged by the rule. Because everything is canonical internally, the editor and the checks only ever look for — they never mistake an unrelated colon or percent sign (a time like , a ratio ) for a placeholder. printf formats ( , in gettext and Apple ) are export-only and lossy — they sit outside the canonical guarantee. See Lossy conversions below. Escaping a literal To write text that looks like a placeholder but should be left alone, use ICU apostrophe quoting : You write You get --- --- a literal the literal text (not a token) a literal apostrophe Quoted spans are treated as plain text, so is never flagged by the checks or altered by AI translation. ARB output (ICU) preserves the quoting on round-trip. ICU plural and select ICU constructs like: are preserved structurally. The rule flags a string where one side (source or translation) is an ICU plural/select and the other isn't. See also Plurals for the dedicated plural-key model. Lossy conversions Not every format can represent every construct. When export hits one it can't faithfully convert, it warns and writes safe output rather than emitting something broken: Treat these warnings as a prompt to simplify the string or pick a different adapter for that output. Related - Plurals · Output Formats · Checks and Validation · How Translation Works`},{id:`guides/continuous-integration`,title:`Continuous Integration`,section:`Guides`,html:`<h1>Continuous Integration</h1>
1721
1897
  <p>Glotfile is built to run in CI so a broken or stale translation state can&#39;t reach <code>main</code>. The key command is <code>glotfile check</code>; <code>glotfile lint</code> gives you finer control.</p>
1722
1898
  <h2>The one-liner</h2>
1723
1899
  <p>Add a single step that validates the catalog <strong>and</strong> confirms exports are up to date:</p>
@@ -1801,7 +1977,7 @@ glotfile lint --locale fr,de # only some locales
1801
1977
  <ul>
1802
1978
  <li>lint and check · Checks and Validation · export · Translation Workflow</li>
1803
1979
  </ul>
1804
- `},{id:`guides/keeping-translations-fresh`,title:`Keeping Translations Fresh`,section:`Guides`,html:`<h1>Keeping Translations Fresh</h1>
1980
+ `,text:`Continuous Integration Glotfile is built to run in CI so a broken or stale translation state can't reach . The key command is ; gives you finer control. The one-liner Add a single step that validates the catalog and confirms exports are up to date: exits non-zero if there are any errors — a lint error or an finding (someone changed copy but forgot to run ). That one command is usually all you need. Tip: Why over + — re-exports in memory and compares to disk, so you don't need to write files and diff. It also catches catalog problems (placeholder mismatches, empty translations, glossary violations) that a diff wouldn't. What gets gated Failure Caught by Default severity --- --- --- Empty source / empty translation , error Placeholder or ICU mismatch , error Glossary violation , error Length / identical-to-source / whitespace / spelling , warn Exported file missing or stale only error Tune severities in — see Checks and Validation. GitHub Actions Note: No credentials needed in CI — and are fully offline — only translate needs an API key. Don't put translation secrets in CI just to validate. Failing on warnings By default only errors fail the build. To hold the line on warnings too: exits when warnings exceed the threshold. Combine with (run both) if you want stale-export gating and zero warnings. Code scanning (SARIF) Emit SARIF and upload it so findings appear inline on the PR, each located at its line in : is also available for custom tooling. Scoping a run Related - lint and check · Checks and Validation · export · Translation Workflow`},{id:`guides/keeping-translations-fresh`,title:`Keeping Translations Fresh`,section:`Guides`,html:`<h1>Keeping Translations Fresh</h1>
1805
1981
  <p>A translation is only correct relative to the source string it was made from. When you edit a source string, its translations may no longer match — Glotfile tracks this so nothing drifts silently.</p>
1806
1982
  <h2>How staleness is detected</h2>
1807
1983
  <p>Each translated value records the <strong>source string it was translated from</strong> (the <code>source</code> field on the value). When you change a source string, any translation whose recorded source no longer matches is flagged <strong><code>needs-review</code></strong>. See Review States.</p>
@@ -1827,7 +2003,7 @@ You change the source to <code>&quot;Log in&quot;</code>. The French value is no
1827
2003
  <ul>
1828
2004
  <li>Review States · How Translation Works · Translation Workflow</li>
1829
2005
  </ul>
1830
- `},{id:`guides/translation-workflow`,title:`Translation Workflow`,section:`Guides`,html:`<h1>Translation Workflow</h1>
2006
+ `,text:`Keeping Translations Fresh A translation is only correct relative to the source string it was made from. When you edit a source string, its translations may no longer match — Glotfile tracks this so nothing drifts silently. How staleness is detected Each translated value records the source string it was translated from (the field on the value). When you change a source string, any translation whose recorded source no longer matches is flagged . See Review States. Example: source → (reviewed, source ). You change the source to . The French value is now marked — it was translated from text that no longer exists. Finding stale translations - In the Editor, filter to needs-review . - Analytics counts per locale. Fixing them 1. Review the flagged value against the new source. 2. Edit it directly and mark it , or 3. Re-translate: a bare only fills empty values, so it won't touch a value that still has text. To have the AI redo non-empty values, run (or clear the stale value first, then ). Either way, a value still marked is protected — unmark it first to have the AI redo it. Why not auto-overwrite? Glotfile flags rather than silently re-translating because a source edit might be cosmetic (a typo fix that doesn't change meaning) or substantive (a different action entirely). Only you know which — so it surfaces the change and lets you decide. Related - Review States · How Translation Works · Translation Workflow`},{id:`guides/translation-workflow`,title:`Translation Workflow`,section:`Guides`,html:`<h1>Translation Workflow</h1>
1831
2007
  <p>The day-to-day loop, end to end. This is the same flow as Quick Start, but with the <em>why</em> behind each step.</p>
1832
2008
  <h2>The loop</h2>
1833
2009
  <pre><code>author ──▶ translate ──▶ review ──▶ export ──▶ commit
@@ -1863,7 +2039,7 @@ git commit -m &quot;Checkout copy + translations&quot;
1863
2039
  <ul>
1864
2040
  <li>Continuous Integration · Keeping Translations Fresh · How Translation Works · Review States</li>
1865
2041
  </ul>
1866
- `},{id:`troubleshooting-and-faq`,title:`Troubleshooting and FAQ`,section:`Help`,html:`<h1>Troubleshooting and FAQ</h1>
2042
+ `,text:`Translation Workflow The day-to-day loop, end to end. This is the same flow as Quick Start, but with the why behind each step. The loop 1. Author source copy as you build Run and add keys with their source strings in the Editor while you build a feature. Add a one-line context for anything ambiguous — it's the highest-leverage thing you can do for translation quality. Attach a screenshot for UI-heavy strings. 2. Fill the other languages This fills only the empty values; pass to re-translate everything. Or use the Editor's translate action. New translations land as . See How Translation Works. 3. Review Filter the Editor to machine and check the new translations. Promote good ones to (which protects them from being overwritten); flag the rest as . Watch the Analytics panel for reviewed-vs-translated coverage. 4. Export This regenerates your apps' locale files from the catalog. See Output Formats. 5. Commit Commit together with your code and the regenerated locale files. The diff is the review: Why git-native pays off Because the catalog is just a file in your repo: - Branching — translations live on the feature branch with the code that needs them. - Pull-request review — reviewers see copy changes as a normal diff. - Rollback — reverting a commit reverts the copy too. - No drift — CI can fail the build if exports are stale or the catalog has problems. Related - Continuous Integration · Keeping Translations Fresh · How Translation Works · Review States`},{id:`troubleshooting-and-faq`,title:`Troubleshooting and FAQ`,section:`Help`,html:`<h1>Troubleshooting and FAQ</h1>
1867
2043
  <h2>Setup</h2>
1868
2044
  <p><strong><code>glotfile: command not found</code></strong>
1869
2045
  It&#39;s pre-1.0 and not yet on npm. Run from a checkout: <code>npm install &amp;&amp; npm run build &amp;&amp; node bin/glotfile.js</code>. See Installation.</p>
@@ -1894,11 +2070,11 @@ You can, but you rarely need to — the UI writes it for you, deterministically.
1894
2070
  Check <code>config.format</code> (<code>indent</code>, <code>sortKeys</code>, <code>finalNewline</code>). Deterministic formatting keeps diffs minimal. See The State File.</p>
1895
2071
  <h2>General</h2>
1896
2072
  <p><strong>Do I already have translations I can import?</strong>
1897
- Importing existing locale files is <strong>🚧 coming soon</strong> — see import. For now, add keys via the Editor.</p>
2073
+ Import existing locale files with <code>glotfile import</code> — see import. You can also add keys via the Editor.</p>
1898
2074
  <p><strong>Does anything leave my machine?</strong>
1899
2075
  Only the AI calls you trigger. The UI is local-only; no credentials or screenshot bytes are ever logged. See AI Log.</p>
1900
2076
  <h2>Related</h2>
1901
2077
  <ul>
1902
2078
  <li>Home · Installation · AI Providers · Continuous Integration</li>
1903
2079
  </ul>
1904
- `}],UN={class:`flex min-h-0 flex-1 overflow-hidden`},WN={class:`flex w-56 shrink-0 flex-col gap-1 overflow-y-auto border-r bg-muted/30 px-2 py-3`},GN=[`onClick`],KN={class:`min-w-0 flex-1 overflow-y-auto`},qN=[`innerHTML`],JN=P({__name:`DocsView`,setup(e){let t=[``,`Getting Started`,`Web UI`,`CLI`,`Concepts`,`AI Translation`,`Reference`,`Guides`,`Help`],n=A(HN[0]?.id??``),r=K(()=>{let e=new Map;for(let n of t)e.set(n,[]);for(let t of HN)e.has(t.section)||e.set(t.section,[]),e.get(t.section).push(t);return t.map(t=>({section:t,pages:e.get(t)??[]})).filter(e=>e.pages.length>0)}),i=K(()=>HN.find(e=>e.id===n.value)??HN[0]);return(e,t)=>(R(),z(`div`,UN,[V(`nav`,WN,[(R(!0),z(L,null,F(r.value,(e,t)=>(R(),z(L,{key:e.section},[e.section?(R(),z(`div`,{key:0,class:O([`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,t>0?`mt-3`:``])},k(e.section),3)):W(``,!0),(R(!0),z(L,null,F(e.pages,e=>(R(),z(`button`,{key:e.id,type:`button`,class:O([`w-full rounded-md px-2 py-1 text-left text-sm transition-colors`,n.value===e.id?`bg-primary text-primary-foreground`:`text-foreground hover:bg-accent hover:text-accent-foreground`]),onClick:t=>n.value=e.id},k(e.title),11,GN))),128))],64))),128))]),V(`div`,KN,[V(`div`,{class:`prose prose-sm dark:prose-invert mx-auto max-w-3xl px-8 py-6`,innerHTML:i.value?.html},null,8,qN)])]))}}),YN={en:`English`,fr:`French`,de:`German`,es:`Spanish`,pt:`Portuguese`,it:`Italian`,nl:`Dutch`,ca:`Catalan`,pl:`Polish`,ru:`Russian`,uk:`Ukrainian`,cs:`Czech`,sk:`Slovak`,sv:`Swedish`,da:`Danish`,no:`Norwegian`,nb:`Norwegian Bokmål`,fi:`Finnish`,tr:`Turkish`,el:`Greek`,ro:`Romanian`,hu:`Hungarian`,bg:`Bulgarian`,hr:`Croatian`,sr:`Serbian`,sl:`Slovenian`,ja:`Japanese`,ko:`Korean`,zh:`Chinese`,ar:`Arabic`,he:`Hebrew`,hi:`Hindi`,th:`Thai`,vi:`Vietnamese`,id:`Indonesian`,ms:`Malay`,fa:`Persian`};function XN(e){let[t=``,n]=e.split(/[-_]/),r=t.toLowerCase(),i=n&&/^[A-Za-z]{2}$/.test(n)?n.toUpperCase():void 0,a=YN[r]??e;return{code:e,name:i?`${a} (${i})`:a}}var ZN={class:`p-6`},QN={class:`flex items-start gap-3 pr-6`},$N={class:`grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-primary/25 bg-primary/10 font-mono text-[13px] font-semibold leading-none tracking-tight text-primary`},eP={class:`min-w-0`},tP={class:`font-medium text-foreground`},nP={class:`font-mono text-[12px]`},rP={class:`mt-4 flex items-center gap-4 rounded-lg border border-border bg-muted/40 px-3.5 py-2.5`},iP={class:`flex flex-col`},aP={class:`text-[17px] font-semibold leading-none tabular-nums`},oP={class:`flex flex-col`},sP={class:`text-[17px] font-semibold leading-none tabular-nums`},cP={class:`ml-auto flex items-center gap-1.5 whitespace-nowrap text-[11px] text-muted-foreground`},lP={class:`mt-5`},uP={class:`!flex min-w-0 items-center gap-2`},dP={class:`font-mono text-[13px]`},fP={class:`truncate text-[13px] text-muted-foreground`},pP={class:`flex items-center gap-2`},mP={class:`font-mono text-[13px]`},hP={class:`text-[13px] text-muted-foreground`},gP={class:`mt-4`},_P={class:`flex items-center justify-between`},vP={class:`whitespace-nowrap text-[12px] tabular-nums text-muted-foreground`},yP={class:`mt-1.5 flex flex-wrap gap-1.5 rounded-lg border border-border bg-muted/30 p-2.5`},bP=[`disabled`,`onClick`],xP={class:`font-mono`},SP={key:0,class:`ml-0.5 rounded-sm bg-primary/15 px-1 text-[9px] font-semibold uppercase tracking-wide text-primary`},CP={key:0,class:`mt-4`},wP={class:`overflow-hidden rounded-lg border border-border`},TP={class:`ml-auto font-mono text-[11px] text-muted-foreground/70`},EP={key:0,class:`divide-y divide-border border-t border-border gf-content-fade`},DP={class:`shrink-0 font-mono text-foreground`},OP={class:`ml-auto truncate text-right text-muted-foreground`},kP={key:0,class:`px-3 py-1.5 text-[11px] text-muted-foreground/70`},AP={class:`flex items-center gap-2 border-t border-border px-6 py-4`},jP={class:`ml-1 flex cursor-pointer select-none items-center gap-1.5 text-[12px] text-muted-foreground`},MP={class:`ml-auto`},NP={class:`flex flex-col items-center justify-center gap-4 p-6 py-8 text-center`},PP={key:0,class:`mt-1 text-[13px] text-muted-foreground`},FP={class:`p-6`},IP={class:`flex flex-col items-center gap-3 pt-1 text-center`},LP={class:`grid h-12 w-12 place-items-center rounded-full bg-success-bg text-success ring-1 ring-success-border`},RP={class:`font-semibold text-foreground tabular-nums`},zP={class:`font-semibold text-foreground`},BP={key:0,class:`mt-5 overflow-hidden rounded-lg border border-warning-border bg-warning-bg/60`},VP={class:`whitespace-nowrap text-[13px] font-medium text-warning`},HP={key:0,class:`max-h-44 divide-y divide-warning-border/40 overflow-auto border-t border-warning-border/70 gf-content-fade`},UP={class:`flex items-center border-t border-border px-6 py-4`},WP={class:`ml-auto`},GP={class:`p-6`},KP={class:`flex items-start gap-3 pr-6`},qP={class:`grid h-10 w-10 shrink-0 place-items-center rounded-full bg-destructive-soft text-destructive`},JP={class:`min-w-0`},YP={class:`flex items-center border-t border-border px-6 py-4`},XP={class:`ml-auto`},ZP=P({__name:`ImportWizard`,emits:[`dismiss`,`imported`],setup(e,{expose:t,emit:n}){let r=n,i=A(!0),a=A(`confirm`),o=A(null),s=A(``),c=A({}),l=A(!1),u=A(!1),d=A(null),f=A(``),p=A(!0);t({init:m});async function m(){try{let e=await kf();if(!e.found){r(`dismiss`);return}o.value=e,s.value=e.sourceLocale}catch{r(`dismiss`)}}let h={"laravel-php":{label:`Laravel PHP`,glyph:`</>`,file:`lang/{locale}/*.php`},"vue-i18n-json":{label:`Vue i18n JSON`,glyph:`{ }`,file:`locales/{locale}.json`},"flutter-arb":{label:`Flutter ARB`,glyph:`arb`,file:`lib/l10n/app_{locale}.arb`},"apple-strings":{label:`Apple .strings`,glyph:``,file:`{locale}.lproj/Localizable.strings`}},g=K(()=>h[o.value?.format??``]??{label:o.value?.format??``,glyph:`{}`,file:``});function _(e){return e===s.value||!c.value[e]}function v(e){e!==s.value&&(c.value={...c.value,[e]:!c.value[e]})}let y=K(()=>o.value?o.value.locales.filter(_):[]),b=K(()=>y.value.length),x=K(()=>o.value?Math.max(0,o.value.keyCount-o.value.sampleKeys.length):0);async function S(){if(o.value){a.value=`importing`;try{d.value=await Af({format:o.value.format,sourceLocale:s.value,locales:y.value,cldr:p.value}),a.value=`done`}catch(e){f.value=e.message,a.value=`error`}}}function C(e){e||a.value!==`importing`&&(a.value===`done`?r(`imported`):r(`dismiss`))}return(e,t)=>(R(),B(j(bh),{open:i.value,"onUpdate:open":C},{default:M(()=>[H(j(sg),null,{default:M(()=>[H(j(ag),{class:`fixed inset-0 z-50 bg-foreground/40 gf-content-fade`}),H(j(ng),{class:`fixed left-1/2 top-1/2 z-50 w-[28rem] max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-card text-card-foreground shadow-2xl focus:outline-none gf-content-fade`,onInteractOutside:t[9]||=q(()=>{},[`prevent`])},{default:M(()=>[a.value===`confirm`&&o.value?(R(),z(L,{key:0},[V(`button`,{type:`button`,class:`absolute right-3.5 top-3.5 z-10 grid h-7 w-7 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:t[0]||=e=>r(`dismiss`)},[H(j(kd),{class:`size-4`})]),V(`div`,ZN,[V(`div`,QN,[V(`div`,$N,k(g.value.glyph),1),V(`div`,eP,[H(j(cg),{class:`text-base font-semibold leading-tight`},{default:M(()=>[...t[10]||=[U(`Import your translations`,-1)]]),_:1}),H(j(rg),{class:`mt-0.5 text-[13px] text-muted-foreground`},{default:M(()=>[t[11]||=U(` Found a `,-1),V(`span`,tP,k(g.value.label),1),t[12]||=U(` setup in `,-1),V(`span`,nP,k(g.value.file),1),t[13]||=U(`. `,-1)]),_:1})])]),V(`div`,rP,[V(`div`,iP,[V(`span`,aP,k(o.value.keyCount.toLocaleString()),1),t[14]||=V(`span`,{class:`mt-1 whitespace-nowrap text-[11px] text-muted-foreground`},`keys detected`,-1)]),t[17]||=V(`div`,{class:`h-7 w-px bg-border`},null,-1),V(`div`,oP,[V(`span`,sP,k(o.value.locales.length),1),t[15]||=V(`span`,{class:`mt-1 whitespace-nowrap text-[11px] text-muted-foreground`},`locales`,-1)]),V(`div`,cP,[H(j(Gu),{class:`size-3.5 opacity-70`}),t[16]||=U(` Detected automatically `,-1)])]),V(`div`,lP,[H(j(IS),{class:`flex items-center gap-1.5 whitespace-nowrap`},{default:M(()=>[...t[18]||=[U(` Source language `,-1),V(`span`,{class:`text-[12px] font-normal text-muted-foreground`},`· the original text`,-1)]]),_:1}),H(j(Iy),{modelValue:s.value,"onUpdate:modelValue":t[1]||=e=>s.value=e},{default:M(()=>[H(j(iS),{class:`mt-1.5`},{default:M(()=>[V(`span`,uP,[H(FC,{code:s.value,size:14},null,8,[`code`]),V(`span`,dP,k(s.value),1),V(`span`,fP,k(j(XN)(s.value).name),1)])]),_:1}),H(j(aS),null,{default:M(()=>[(R(!0),z(L,null,F(o.value.locales,e=>(R(),B(j(sS),{key:e,value:e},{default:M(()=>[V(`span`,pP,[H(FC,{code:e,size:14},null,8,[`code`]),V(`span`,mP,k(e),1),V(`span`,hP,k(j(XN)(e).name),1)])]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`modelValue`])]),V(`div`,gP,[V(`div`,_P,[H(j(IS),{class:`whitespace-nowrap`},{default:M(()=>[...t[19]||=[U(`Locales to import`,-1)]]),_:1}),V(`span`,vP,k(b.value)+` of `+k(o.value.locales.length),1)]),V(`div`,yP,[(R(!0),z(L,null,F(o.value.locales,e=>(R(),B(j(Sb),{key:e},{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`button`,{type:`button`,disabled:e===s.value,class:O([`group inline-flex h-7 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border pl-1.5 pr-2 text-[12px] transition-colors`,e===s.value?`border-primary/40 bg-primary/10 cursor-default`:_(e)?`border-input bg-card text-foreground hover:bg-muted`:`border-dashed border-border bg-transparent text-muted-foreground hover:bg-muted/50`]),onClick:t=>v(e)},[H(FC,{code:e,size:14},null,8,[`code`]),V(`span`,xP,k(e),1),e===s.value?(R(),z(`span`,SP,`src`)):(R(),z(`span`,{key:1,class:O([`grid size-3.5 place-items-center rounded-[3px] border`,_(e)?`border-primary bg-primary text-primary-foreground`:`border-border text-transparent`])},[H(j(Du),{class:`size-2.5`,"stroke-width":3})],2))],10,bP)]),_:2},1024),H(j(ZS),null,{default:M(()=>[U(k(e===s.value?`Source language — always imported`:_(e)?`Click to exclude`:`Click to include`),1)]),_:2},1024)]),_:2},1024))),128))])]),o.value.sampleKeys.length?(R(),z(`div`,CP,[V(`div`,wP,[V(`button`,{type:`button`,class:`flex w-full items-center gap-2 px-3 py-2 text-[13px] text-muted-foreground transition-colors hover:bg-muted/50`,onClick:t[2]||=e=>l.value=!l.value},[H(j(ku),{class:O([`size-3.5 shrink-0 transition-transform`,l.value?`rotate-90`:``])},null,8,[`class`]),t[20]||=V(`span`,{class:`whitespace-nowrap`},`Preview sample keys`,-1),V(`span`,TP,k(g.value.glyph),1)]),l.value?(R(),z(`div`,EP,[(R(!0),z(L,null,F(o.value.sampleKeys,e=>(R(),z(`div`,{key:e.key,class:`flex items-baseline gap-3 px-3 py-1.5 text-[12px]`},[V(`span`,DP,k(e.key),1),V(`span`,OP,k(e.value),1)]))),128)),x.value>0?(R(),z(`div`,kP,` + `+k(x.value.toLocaleString())+` more keys `,1)):W(``,!0)])):W(``,!0)])])):W(``,!0)]),V(`div`,AP,[H(j(Q),{variant:`ghost`,size:`sm`,onClick:t[3]||=e=>r(`dismiss`)},{default:M(()=>[...t[21]||=[U(`Skip`,-1)]]),_:1}),H(j(Sb),null,{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`label`,jP,[vr(V(`input`,{type:`checkbox`,"data-testid":`cldr-toggle`,"onUpdate:modelValue":t[4]||=e=>p.value=e,class:`size-3.5 accent-primary`},null,512),[[Il,p.value]]),t[22]||=U(` Convert plurals to CLDR categories `,-1)])]),_:1}),H(j(ZS),{class:`max-w-xs`},{default:M(()=>[...t[23]||=[U(`Rewrite exact =N plural selectors (e.g. =1) into each language's CLDR plural categories, the way Crowdin does.`,-1)]]),_:1})]),_:1}),V(`div`,MP,[H(j(Q),{"data-testid":`import-btn`,disabled:b.value===0,onClick:S},{default:M(()=>[H(j(Ad),{class:`size-4`}),U(` Import `+k(b.value)+` `+k(b.value===1?`locale`:`locales`),1)]),_:1},8,[`disabled`])])])],64)):a.value===`importing`?(R(),z(L,{key:1},[H(j(cg),{class:`sr-only`},{default:M(()=>[...t[24]||=[U(`Importing translations`,-1)]]),_:1}),V(`div`,NP,[H(j($u),{class:`size-10 text-primary gf-spin`}),V(`div`,null,[t[25]||=V(`div`,{class:`text-sm font-semibold`},`Importing translations…`,-1),o.value?(R(),z(`div`,PP,` Reading `+k(o.value.keyCount.toLocaleString())+` keys across `+k(b.value)+` locales `,1)):W(``,!0)])])],64)):a.value===`done`&&d.value?(R(),z(L,{key:2},[V(`div`,FP,[V(`div`,IP,[V(`div`,LP,[H(j(Du),{class:`size-6`,"stroke-width":2.5})]),V(`div`,null,[H(j(cg),{class:`text-base font-semibold`},{default:M(()=>[...t[26]||=[U(`Import complete`,-1)]]),_:1}),H(j(rg),{class:`mt-1 text-[13px] text-muted-foreground`},{default:M(()=>[V(`span`,RP,k(d.value.keyCount.toLocaleString())+` keys`,1),t[27]||=U(` across `,-1),V(`span`,zP,k(d.value.localeCount)+` locales`,1),t[28]||=U(` imported. `,-1)]),_:1})])]),d.value.warnings.length?(R(),z(`div`,BP,[V(`button`,{type:`button`,class:`flex w-full items-center gap-2 px-3 py-2.5 text-left`,onClick:t[5]||=e=>u.value=!u.value},[H(j(Td),{class:`size-3.5 shrink-0 text-warning`}),V(`span`,VP,k(d.value.warnings.length)+` `+k(d.value.warnings.length===1?`warning`:`warnings`),1),t[29]||=V(`span`,{class:`whitespace-nowrap text-[12px] text-warning/70`},`· import still succeeded`,-1),H(j(ku),{class:O([`ml-auto size-3.5 shrink-0 text-warning transition-transform`,u.value?`rotate-90`:``])},null,8,[`class`])]),u.value?(R(),z(`ul`,HP,[(R(!0),z(L,null,F(d.value.warnings,(e,t)=>(R(),z(`li`,{key:t,class:`px-3 py-2 text-[12px] text-muted-foreground`},k(e),1))),128))])):W(``,!0)])):W(``,!0)]),V(`div`,UP,[V(`div`,WP,[H(j(Q),{onClick:t[6]||=e=>r(`imported`)},{default:M(()=>[t[30]||=U(`Open editor `,-1),H(j(bu),{class:`size-4`})]),_:1})])])],64)):a.value===`error`?(R(),z(L,{key:3},[V(`button`,{type:`button`,class:`absolute right-3.5 top-3.5 z-10 grid h-7 w-7 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:t[7]||=e=>r(`dismiss`)},[H(j(kd),{class:`size-4`})]),V(`div`,GP,[V(`div`,KP,[V(`div`,qP,[H(j(Td),{class:`size-5`})]),V(`div`,JP,[H(j(cg),{class:`text-base font-semibold`},{default:M(()=>[...t[31]||=[U(`Couldn't import translations`,-1)]]),_:1}),H(j(rg),{class:`mt-1 text-[13px] text-muted-foreground`},{default:M(()=>[U(k(f.value),1)]),_:1})])])]),V(`div`,YP,[V(`div`,XP,[H(j(Q),{variant:`outline`,onClick:t[8]||=e=>r(`dismiss`)},{default:M(()=>[...t[32]||=[U(`Dismiss`,-1)]]),_:1})])])],64)):W(``,!0)]),_:1})]),_:1})]),_:1},8,[`open`]))}}),QP=`glotfile-theme`,$P=[`system`,`light`,`dark`],eF=e=>$P.includes(e);function tF(){let e=localStorage.getItem(QP);return eF(e)?e:`system`}var nF=window.matchMedia(`(prefers-color-scheme: dark)`),rF=A(nF.matches);nF.addEventListener(`change`,e=>{rF.value=e.matches});var iF=A(tF()),aF=K(()=>iF.value===`system`?rF.value:iF.value===`dark`);function oF(){document.documentElement.classList.toggle(`dark`,aF.value)}function sF(){N(aF,oF,{immediate:!0,flush:`sync`})}function cF(e){iF.value=e,localStorage.setItem(QP,e),tf({theme:e}).catch(()=>{})}async function lF(){try{let{theme:e}=await ef();eF(e)&&e!==iF.value&&(iF.value=e,localStorage.setItem(QP,e))}catch{}}var uF={class:`flex flex-col items-center gap-0.5 rounded-lg bg-black/15 p-0.5`},dF=[`data-mode`,`aria-label`,`aria-pressed`,`onClick`],fF=P({__name:`ThemeToggle`,setup(e){let t=[{value:`light`,label:`Light`,icon:xd},{value:`system`,label:`System`,icon:nd},{value:`dark`,label:`Dark`,icon:rd}];return(e,n)=>(R(),z(`div`,uF,[(R(),z(L,null,F(t,e=>H(j(Sb),{key:e.value},{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`button`,{type:`button`,"data-mode":e.value,"aria-label":e.label,"aria-pressed":j(iF)===e.value,class:O(j(eS)(`flex size-8 items-center justify-center rounded-md transition-colors`,j(iF)===e.value?`bg-primary text-primary-foreground`:`text-rail-foreground/70 hover:bg-white/10 hover:text-rail-foreground`)),onClick:t=>j(cF)(e.value)},[(R(),B(aa(e.icon),{class:`size-4`}))],10,dF)]),_:2},1024),H(j(ZS),{side:`right`},{default:M(()=>[U(k(e.label),1)]),_:2},1024)]),_:2},1024)),64))]))}}),pF=P({__name:`Kbd`,props:{class:{}},setup(e){return(e,t)=>(R(),z(`kbd`,{class:O(j(eS)(`inline-flex h-5 min-w-5 items-center justify-center rounded border bg-muted px-1.5 font-mono text-xs font-medium text-muted-foreground`,e.$props.class))},[I(e.$slots,`default`)],2))}}),mF=[{route:`editor`,keys:[`g`,`e`],label:`Editor`},{route:`analytics`,keys:[`g`,`a`],label:`Analytics`},{route:`glossary`,keys:[`g`,`g`],label:`Glossary`},{route:`screenshots`,keys:[`g`,`i`],label:`Screenshots`},{route:`settings`,keys:[`g`,`s`],label:`Settings`},{route:`activity`,keys:[`g`,`l`],label:`Activity`},{route:`docs`,keys:[`g`,`d`],label:`Docs`}];function hF(e,t){if(e.pending===`g`){let e=mF.find(e=>e.keys[1]===t);return{state:{pending:null},action:e?{type:`navigate`,route:e.route}:null}}return t===`g`?{state:{pending:`g`},action:null}:t===`?`?{state:{pending:null},action:{type:`toggleHelp`}}:{state:{pending:null},action:null}}var gF={class:`flex w-14 shrink-0 flex-col items-center gap-1 bg-rail py-3 text-rail-foreground`},_F=[`aria-label`,`onClick`],vF={key:0,class:`flex items-center gap-0.5`},yF={class:`mt-auto`},bF=P({__name:`NavRail`,setup(e){let t=Sp(),n=[{id:`editor`,label:`Editor`,icon:Zu},{id:`analytics`,label:`Analytics`,icon:Eu},{id:`glossary`,label:`Glossary`,icon:Tu},{id:`screenshots`,label:`Screenshots`,icon:Yu},{id:`settings`,label:`Settings`,icon:md},{id:`activity`,label:`Activity`,icon:fd},{id:`docs`,label:`Docs`,icon:Cu}].map(e=>({...e,keys:mF.find(t=>t.route===e.id)?.keys}));return(e,r)=>(R(),B(j(vb),{"delay-duration":300},{default:M(()=>[V(`nav`,gF,[r[0]||=V(`div`,{class:`mb-3 flex size-9 items-center justify-center rounded-md bg-primary font-mono text-base font-semibold text-primary-foreground`},` G `,-1),(R(!0),z(L,null,F(j(n),e=>(R(),B(j(Sb),{key:e.id},{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`button`,{type:`button`,"aria-label":e.label,class:O(j(eS)(`relative flex size-10 items-center justify-center rounded-md transition-colors`,j(t)===e.id?`bg-primary text-primary-foreground`:`text-rail-foreground/70 hover:bg-white/10 hover:text-rail-foreground`)),onClick:t=>j(xp)(e.id)},[(R(),B(aa(e.icon),{class:`size-5`}))],10,_F)]),_:2},1024),H(j(ZS),{side:`right`,class:`flex items-center gap-2`},{default:M(()=>[V(`span`,null,k(e.label),1),e.keys?(R(),z(`span`,vF,[(R(!0),z(L,null,F(e.keys,(e,t)=>(R(),B(pF,{key:t},{default:M(()=>[U(k(e),1)]),_:2},1024))),128))])):W(``,!0)]),_:2},1024)]),_:2},1024))),128)),V(`div`,yF,[H(fF)])])]),_:1}))}}),xF={class:`flex flex-col gap-1`},SF={class:`flex items-center gap-1`},CF={class:`flex items-center justify-between py-1 text-sm`},wF={class:`flex items-center gap-1`},TF=P({__name:`ShortcutsDialog`,props:{open:{type:Boolean,required:!0},openModifiers:{}},emits:[`update:open`],setup(e){let t=Za(e,`open`);return(e,n)=>(R(),B(j(bh),{open:t.value,"onUpdate:open":n[0]||=e=>t.value=e},{default:M(()=>[H(j(LS),{class:`max-w-sm`},{default:M(()=>[H(j(RS),null,{default:M(()=>[H(j(BS),null,{default:M(()=>[...n[1]||=[U(`Keyboard shortcuts`,-1)]]),_:1})]),_:1}),V(`ul`,xF,[(R(!0),z(L,null,F(j(mF),e=>(R(),z(`li`,{key:e.route,class:`flex items-center justify-between py-1 text-sm`},[V(`span`,null,k(e.label),1),V(`span`,SF,[(R(!0),z(L,null,F(e.keys,(e,t)=>(R(),B(pF,{key:t},{default:M(()=>[U(k(e),1)]),_:2},1024))),128))])]))),128)),V(`li`,CF,[n[3]||=V(`span`,null,`Search keys`,-1),V(`span`,wF,[H(pF,null,{default:M(()=>[...n[2]||=[U(`/`,-1)]]),_:1})])])])]),_:1})]),_:1},8,[`open`]))}}),EF=A(!1),DF=1e3;function OF(){let e={pending:null},t=null;function n(){t!==null&&(clearTimeout(t),t=null)}function r(r){if(r.metaKey||r.ctrlKey||r.altKey||r.repeat)return;let i=r.target;if(i&&(i.tagName===`INPUT`||i.tagName===`TEXTAREA`||i.isContentEditable))return;let a=r.key.toLowerCase(),o=!!document.querySelector(`[role="dialog"],[role="menu"],[role="listbox"]`),s=a===`?`&&EF.value;if(o&&!s)return;let c=hF(e,a);e=c.state,n(),e.pending===`g`&&(t=window.setTimeout(()=>{e={pending:null},t=null},DF));let{action:l}=c;l&&(l.type===`navigate`?xp(l.route):EF.value=!EF.value,r.preventDefault())}Ki(()=>window.addEventListener(`keydown`,r)),Xi(()=>{n(),window.removeEventListener(`keydown`,r)})}var kF={class:`flex h-screen bg-background text-foreground`},AF={class:`flex min-w-0 flex-1 flex-col`},jF={class:`flex h-12 shrink-0 items-center justify-between border-b px-4`},MF={class:`flex min-w-0 items-center gap-3`},NF={key:0,class:`flex min-w-0 items-center gap-1.5`},PF={class:`max-w-[12rem] shrink-0 truncate font-mono text-sm font-medium`},FF={class:`truncate`},IF={key:0,class:`text-muted-foreground`},LF={class:`text-sm font-semibold`},RF={class:`font-mono`},zF={class:`flex min-h-0 flex-1 flex-col overflow-hidden`},BF=P({__name:`App`,setup(e){let t=Sp();OF();let n=fn(null),r=A(null),i=A([]),a=K(()=>[...i.value].sort((e,t)=>{let n=e.relDir?`${e.relDir}/${e.name}`:e.name,r=t.relDir?`${t.relDir}/${t.name}`:t.name;return n.localeCompare(r)})),o=A(!1),s=A(null);async function c(){n.value=await jd()}Ki(async()=>{await c();try{[r.value,i.value]=await Promise.all([xf(),Sf()]),document.title=r.value.project?`${r.value.project} — Glotfile`:`Glotfile`}catch(e){$.error(e.message)}n.value&&Object.keys(n.value.keys).length===0&&(o.value=!0)});function l(){location.reload()}async function u(e){if(e!==r.value?.path)try{await Cf(e),location.reload()}catch(e){$.error(e.message)}}let d=K(()=>({editor:`Editor`,analytics:`Analytics`,glossary:`Glossary`,screenshots:`Screenshots`,settings:`Settings`,activity:`Activity`,docs:`Docs`})[t.value]),f=K(()=>{if(!n.value)return null;let{sourceLocale:e,locales:t}=n.value.config;return{source:e,targets:t.filter(t=>t!==e)}});return(e,n)=>(R(),B(j(vb),{"delay-duration":300},{default:M(()=>[V(`div`,kF,[H(bF),V(`div`,AF,[V(`header`,jF,[V(`div`,MF,[r.value?(R(),z(`div`,NF,[H(j(Sb),null,{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`span`,PF,k(r.value.project),1)]),_:1}),H(j(ZS),{side:`bottom`,class:`font-mono`},{default:M(()=>[U(k(r.value.dir),1)]),_:1})]),_:1}),H(j(ku),{class:`size-3.5 shrink-0 text-muted-foreground`}),H(j(by),null,{default:M(()=>[H(j(Ey),{"as-child":``},{default:M(()=>[H(j(Q),{variant:`outline`,size:`sm`,class:`max-w-[16rem] gap-1.5 font-mono`},{default:M(()=>[V(`span`,FF,k(r.value.name),1),H(j(Au),{class:`size-3.5 shrink-0 text-muted-foreground`})]),_:1})]),_:1}),H(j(HS),{align:`start`,class:`w-max`},{default:M(()=>[(R(!0),z(L,null,F(a.value,e=>(R(),B(j(US),{key:e.path,class:`font-mono`,onSelect:t=>u(e.path)},{default:M(()=>[H(j(Du),{class:O([`size-4 shrink-0`,e.path===r.value.path?`opacity-100`:`opacity-0`])},null,8,[`class`]),V(`span`,null,[e.relDir?(R(),z(`span`,IF,k(e.relDir)+`/`,1)):W(``,!0),U(k(e.name),1)])]),_:2},1032,[`onSelect`]))),128))]),_:1})]),_:1})])):W(``,!0),V(`h1`,LF,k(d.value),1)]),f.value?(R(),B(j(Sb),{key:0},{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`button`,{type:`button`,class:`shrink-0 font-mono text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:n[0]||=e=>j(xp)(`settings`)},k(f.value.source)+` → `+k(f.value.targets.length)+` `+k(f.value.targets.length===1?`locale`:`locales`),1)]),_:1}),H(j(ZS),{side:`bottom`,class:`max-w-[28rem] leading-relaxed`},{default:M(()=>[V(`div`,RF,k(f.value.targets.join(`, `)||`—`),1),n[4]||=V(`div`,{class:`mt-1 text-background/60`},`Click to manage in Settings`,-1)]),_:1})]),_:1})):W(``,!0)]),V(`main`,zF,[j(t)===`editor`?(R(),B(bD,{key:0})):j(t)===`analytics`?(R(),B(mk,{key:1})):j(t)===`glossary`?(R(),B(Bk,{key:2})):j(t)===`screenshots`?(R(),B(mN,{key:3})):j(t)===`settings`?(R(),B(QM,{key:4})):j(t)===`activity`?(R(),B(VN,{key:5})):j(t)===`docs`?(R(),B(JN,{key:6})):W(``,!0)])]),H(j(AS)),H(TF,{open:j(EF),"onUpdate:open":n[1]||=e=>dn(EF)?EF.value=e:null},null,8,[`open`]),o.value?(R(),B(ZP,{key:0,ref_key:`wizardRef`,ref:s,onVnodeMounted:n[2]||=e=>s.value?.init(),onDismiss:n[3]||=e=>o.value=!1,onImported:l},null,512)):W(``,!0)])]),_:1}))}});sF(),iu(BF).mount(`#app`),lF(),JE(),kw();
2080
+ `,text:`Troubleshooting and FAQ Setup It's pre-1.0 and not yet on npm. Run from a checkout: . See Installation. Wrong Node version Glotfile needs Node . Check with . Translation "Install the SDK for this provider" OpenAI, OpenRouter, and Bedrock need an optional SDK. Install the one for your provider — (OpenAI or OpenRouter) or (Bedrock). See AI Providers. No API key / auth errors Set the provider's credentials in your environment or a local : , , , or the AWS chain. See AI Providers. A translation was skipped The result failed validation — a dropped placeholder, broken ICU, or an over-length value. Glotfile prints the reason and leaves the value untranslated. See Placeholders and ICU and How Translation Works. My reviewed translation didn't change after That's intentional — values are protected from being overwritten. Unmark it first to re-translate. Screenshots seem ignored The selected model may not support vision (e.g. Bedrock Meta Llama text models). The run proceeds text-only and warns how many screenshots were skipped. See Screenshots. Validation and CI fails with Your exported files don't match the catalog. Run and commit the result. See Continuous Integration. Spelling flags real words Add them to the custom dictionary in Settings ( ). The same list silences both the editor's live spell check and the lint rule. Glossary terms are accepted automatically. See Checks and Validation. A rule is too noisy Override its severity (or turn it off) in , or certain key globs. See Configuration Reference. Files and git Can I edit by hand? You can, but you rarely need to — the UI writes it for you, deterministically. If you do edit it, keep it valid: it's validated on load. See The State File. Big diffs on every save Check ( , , ). Deterministic formatting keeps diffs minimal. See The State File. General Do I already have translations I can import? Import existing locale files with — see import. You can also add keys via the Editor. Does anything leave my machine? Only the AI calls you trigger. The UI is local-only; no credentials or screenshot bytes are ever logged. See AI Log. Related - Home · Installation · AI Providers · Continuous Integration`}],UN={class:`flex min-h-0 flex-1 overflow-hidden`},WN={class:`flex w-56 shrink-0 flex-col overflow-hidden border-r bg-muted/30`},GN={class:`relative shrink-0 px-2 py-2`},KN={key:0,class:`flex flex-col gap-1 overflow-y-auto px-2 pb-3`},qN={class:`px-2 py-1 text-xs text-muted-foreground`},JN=[`onClick`],YN={class:`text-sm font-medium`},XN={key:0,class:`text-[10px] uppercase tracking-wider text-muted-foreground`},ZN={key:1,class:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`},QN={class:`bg-primary/20 text-foreground`},$N={key:1,class:`flex flex-col gap-1 overflow-y-auto px-2 pb-3`},eP=[`onClick`],tP={class:`min-w-0 flex-1 overflow-y-auto`},nP=[`innerHTML`],rP=P({__name:`DocsView`,setup(e){let t=[``,`Getting Started`,`Web UI`,`CLI`,`Concepts`,`AI Translation`,`Reference`,`Guides`,`Help`],n=A(HN[0]?.id??``),r=A(``),i=K(()=>{let e=new Map;for(let n of t)e.set(n,[]);for(let t of HN)e.has(t.section)||e.set(t.section,[]),e.get(t.section).push(t);return t.map(t=>({section:t,pages:e.get(t)??[]})).filter(e=>e.pages.length>0)}),a=K(()=>{let e=r.value.trim().toLowerCase();if(!e)return[];let t=[];for(let n of HN){let r=n.text.toLowerCase(),i=n.title.toLowerCase().includes(e),a=r.indexOf(e);if(a===-1&&!i)continue;if(a===-1){t.push({id:n.id,title:n.title,section:n.section,before:``,match:``,after:``});continue}let o=Math.max(0,a-40),s=Math.min(n.text.length,a+e.length+80);t.push({id:n.id,title:n.title,section:n.section,before:(o>0?`…`:``)+n.text.slice(o,a),match:n.text.slice(a,a+e.length),after:n.text.slice(a+e.length,s)+(s<n.text.length?`…`:``)})}return t}),o=K(()=>HN.find(e=>e.id===n.value)??HN[0]);function s(e){n.value=e,r.value=``}return(e,t)=>(R(),z(`div`,UN,[V(`nav`,WN,[V(`div`,GN,[H(j(pd),{class:`pointer-events-none absolute left-4 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),vr(V(`input`,{"onUpdate:modelValue":t[0]||=e=>r.value=e,type:`search`,placeholder:`Search docs…`,class:`w-full rounded-md border bg-background py-1 pl-7 pr-7 text-sm outline-none focus:ring-2 focus:ring-ring`},null,512),[[Fl,r.value]]),r.value?(R(),z(`button`,{key:0,type:`button`,class:`absolute right-4 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:t[1]||=e=>r.value=``},[H(j(kd),{class:`size-3.5`})])):W(``,!0)]),r.value.trim()?(R(),z(`div`,KN,[V(`div`,qN,k(a.value.length)+` result`+k(a.value.length===1?``:`s`),1),(R(!0),z(L,null,F(a.value,e=>(R(),z(`button`,{key:e.id,type:`button`,class:`w-full rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground`,onClick:t=>s(e.id)},[V(`div`,YN,k(e.title),1),e.section?(R(),z(`div`,XN,k(e.section),1)):W(``,!0),e.match?(R(),z(`div`,ZN,[U(k(e.before),1),V(`mark`,QN,k(e.match),1),U(k(e.after),1)])):W(``,!0)],8,JN))),128))])):(R(),z(`div`,$N,[(R(!0),z(L,null,F(i.value,(e,t)=>(R(),z(L,{key:e.section},[e.section?(R(),z(`div`,{key:0,class:O([`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,t>0?`mt-3`:``])},k(e.section),3)):W(``,!0),(R(!0),z(L,null,F(e.pages,e=>(R(),z(`button`,{key:e.id,type:`button`,class:O([`w-full rounded-md px-2 py-1 text-left text-sm transition-colors`,n.value===e.id?`bg-primary text-primary-foreground`:`text-foreground hover:bg-accent hover:text-accent-foreground`]),onClick:t=>n.value=e.id},k(e.title),11,eP))),128))],64))),128))]))]),V(`div`,tP,[V(`div`,{class:`prose prose-sm dark:prose-invert mx-auto max-w-3xl px-8 py-6`,innerHTML:o.value?.html},null,8,nP)])]))}}),iP={en:`English`,fr:`French`,de:`German`,es:`Spanish`,pt:`Portuguese`,it:`Italian`,nl:`Dutch`,ca:`Catalan`,pl:`Polish`,ru:`Russian`,uk:`Ukrainian`,cs:`Czech`,sk:`Slovak`,sv:`Swedish`,da:`Danish`,no:`Norwegian`,nb:`Norwegian Bokmål`,fi:`Finnish`,tr:`Turkish`,el:`Greek`,ro:`Romanian`,hu:`Hungarian`,bg:`Bulgarian`,hr:`Croatian`,sr:`Serbian`,sl:`Slovenian`,ja:`Japanese`,ko:`Korean`,zh:`Chinese`,ar:`Arabic`,he:`Hebrew`,hi:`Hindi`,th:`Thai`,vi:`Vietnamese`,id:`Indonesian`,ms:`Malay`,fa:`Persian`};function aP(e){let[t=``,n]=e.split(/[-_]/),r=t.toLowerCase(),i=n&&/^[A-Za-z]{2}$/.test(n)?n.toUpperCase():void 0,a=iP[r]??e;return{code:e,name:i?`${a} (${i})`:a}}var oP={class:`p-6`},sP={class:`flex items-start gap-3 pr-6`},cP={class:`grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-primary/25 bg-primary/10 font-mono text-[13px] font-semibold leading-none tracking-tight text-primary`},lP={class:`min-w-0`},uP={class:`font-medium text-foreground`},dP={class:`font-mono text-[12px]`},fP={class:`mt-4 flex items-center gap-4 rounded-lg border border-border bg-muted/40 px-3.5 py-2.5`},pP={class:`flex flex-col`},mP={class:`text-[17px] font-semibold leading-none tabular-nums`},hP={class:`flex flex-col`},gP={class:`text-[17px] font-semibold leading-none tabular-nums`},_P={class:`ml-auto flex items-center gap-1.5 whitespace-nowrap text-[11px] text-muted-foreground`},vP={class:`mt-5`},yP={class:`!flex min-w-0 items-center gap-2`},bP={class:`font-mono text-[13px]`},xP={class:`truncate text-[13px] text-muted-foreground`},SP={class:`flex items-center gap-2`},CP={class:`font-mono text-[13px]`},wP={class:`text-[13px] text-muted-foreground`},TP={class:`mt-4`},EP={class:`flex items-center justify-between`},DP={class:`whitespace-nowrap text-[12px] tabular-nums text-muted-foreground`},OP={class:`mt-1.5 flex flex-wrap gap-1.5 rounded-lg border border-border bg-muted/30 p-2.5`},kP=[`disabled`,`onClick`],AP={class:`font-mono`},jP={key:0,class:`ml-0.5 rounded-sm bg-primary/15 px-1 text-[9px] font-semibold uppercase tracking-wide text-primary`},MP={key:0,class:`mt-4`},NP={class:`overflow-hidden rounded-lg border border-border`},PP={class:`ml-auto font-mono text-[11px] text-muted-foreground/70`},FP={key:0,class:`divide-y divide-border border-t border-border gf-content-fade`},IP={class:`shrink-0 font-mono text-foreground`},LP={class:`ml-auto truncate text-right text-muted-foreground`},RP={key:0,class:`px-3 py-1.5 text-[11px] text-muted-foreground/70`},zP={class:`flex items-center gap-2 border-t border-border px-6 py-4`},BP={class:`ml-1 flex cursor-pointer select-none items-center gap-1.5 text-[12px] text-muted-foreground`},VP={class:`ml-auto`},HP={class:`flex flex-col items-center justify-center gap-4 p-6 py-8 text-center`},UP={key:0,class:`mt-1 text-[13px] text-muted-foreground`},WP={class:`p-6`},GP={class:`flex flex-col items-center gap-3 pt-1 text-center`},KP={class:`grid h-12 w-12 place-items-center rounded-full bg-success-bg text-success ring-1 ring-success-border`},qP={class:`font-semibold text-foreground tabular-nums`},JP={class:`font-semibold text-foreground`},YP={key:0,class:`mt-5 overflow-hidden rounded-lg border border-warning-border bg-warning-bg/60`},XP={class:`whitespace-nowrap text-[13px] font-medium text-warning`},ZP={key:0,class:`max-h-44 divide-y divide-warning-border/40 overflow-auto border-t border-warning-border/70 gf-content-fade`},QP={class:`flex items-center border-t border-border px-6 py-4`},$P={class:`ml-auto`},eF={class:`p-6`},tF={class:`flex items-start gap-3 pr-6`},nF={class:`grid h-10 w-10 shrink-0 place-items-center rounded-full bg-destructive-soft text-destructive`},rF={class:`min-w-0`},iF={class:`flex items-center border-t border-border px-6 py-4`},aF={class:`ml-auto`},oF=P({__name:`ImportWizard`,emits:[`dismiss`,`imported`],setup(e,{expose:t,emit:n}){let r=n,i=A(!0),a=A(`confirm`),o=A(null),s=A(``),c=A({}),l=A(!1),u=A(!1),d=A(null),f=A(``),p=A(!0);t({init:m});async function m(){try{let e=await kf();if(!e.found){r(`dismiss`);return}o.value=e,s.value=e.sourceLocale}catch{r(`dismiss`)}}let h={"laravel-php":{label:`Laravel PHP`,glyph:`</>`,file:`lang/{locale}/*.php`},"vue-i18n-json":{label:`Vue i18n JSON`,glyph:`{ }`,file:`locales/{locale}.json`},"flutter-arb":{label:`Flutter ARB`,glyph:`arb`,file:`lib/l10n/app_{locale}.arb`},"apple-strings":{label:`Apple .strings`,glyph:``,file:`{locale}.lproj/Localizable.strings`}},g=K(()=>h[o.value?.format??``]??{label:o.value?.format??``,glyph:`{}`,file:``});function _(e){return e===s.value||!c.value[e]}function v(e){e!==s.value&&(c.value={...c.value,[e]:!c.value[e]})}let y=K(()=>o.value?o.value.locales.filter(_):[]),b=K(()=>y.value.length),x=K(()=>o.value?Math.max(0,o.value.keyCount-o.value.sampleKeys.length):0);async function S(){if(o.value){a.value=`importing`;try{d.value=await Af({format:o.value.format,sourceLocale:s.value,locales:y.value,cldr:p.value}),a.value=`done`}catch(e){f.value=e.message,a.value=`error`}}}function C(e){e||a.value!==`importing`&&(a.value===`done`?r(`imported`):r(`dismiss`))}return(e,t)=>(R(),B(j(bh),{open:i.value,"onUpdate:open":C},{default:M(()=>[H(j(sg),null,{default:M(()=>[H(j(ag),{class:`fixed inset-0 z-50 bg-foreground/40 gf-content-fade`}),H(j(ng),{class:`fixed left-1/2 top-1/2 z-50 w-[28rem] max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-card text-card-foreground shadow-2xl focus:outline-none gf-content-fade`,onInteractOutside:t[9]||=q(()=>{},[`prevent`])},{default:M(()=>[a.value===`confirm`&&o.value?(R(),z(L,{key:0},[V(`button`,{type:`button`,class:`absolute right-3.5 top-3.5 z-10 grid h-7 w-7 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:t[0]||=e=>r(`dismiss`)},[H(j(kd),{class:`size-4`})]),V(`div`,oP,[V(`div`,sP,[V(`div`,cP,k(g.value.glyph),1),V(`div`,lP,[H(j(cg),{class:`text-base font-semibold leading-tight`},{default:M(()=>[...t[10]||=[U(`Import your translations`,-1)]]),_:1}),H(j(rg),{class:`mt-0.5 text-[13px] text-muted-foreground`},{default:M(()=>[t[11]||=U(` Found a `,-1),V(`span`,uP,k(g.value.label),1),t[12]||=U(` setup in `,-1),V(`span`,dP,k(g.value.file),1),t[13]||=U(`. `,-1)]),_:1})])]),V(`div`,fP,[V(`div`,pP,[V(`span`,mP,k(o.value.keyCount.toLocaleString()),1),t[14]||=V(`span`,{class:`mt-1 whitespace-nowrap text-[11px] text-muted-foreground`},`keys detected`,-1)]),t[17]||=V(`div`,{class:`h-7 w-px bg-border`},null,-1),V(`div`,hP,[V(`span`,gP,k(o.value.locales.length),1),t[15]||=V(`span`,{class:`mt-1 whitespace-nowrap text-[11px] text-muted-foreground`},`locales`,-1)]),V(`div`,_P,[H(j(Gu),{class:`size-3.5 opacity-70`}),t[16]||=U(` Detected automatically `,-1)])]),V(`div`,vP,[H(j(IS),{class:`flex items-center gap-1.5 whitespace-nowrap`},{default:M(()=>[...t[18]||=[U(` Source language `,-1),V(`span`,{class:`text-[12px] font-normal text-muted-foreground`},`· the original text`,-1)]]),_:1}),H(j(Iy),{modelValue:s.value,"onUpdate:modelValue":t[1]||=e=>s.value=e},{default:M(()=>[H(j(iS),{class:`mt-1.5`},{default:M(()=>[V(`span`,yP,[H(FC,{code:s.value,size:14},null,8,[`code`]),V(`span`,bP,k(s.value),1),V(`span`,xP,k(j(aP)(s.value).name),1)])]),_:1}),H(j(aS),null,{default:M(()=>[(R(!0),z(L,null,F(o.value.locales,e=>(R(),B(j(sS),{key:e,value:e},{default:M(()=>[V(`span`,SP,[H(FC,{code:e,size:14},null,8,[`code`]),V(`span`,CP,k(e),1),V(`span`,wP,k(j(aP)(e).name),1)])]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`modelValue`])]),V(`div`,TP,[V(`div`,EP,[H(j(IS),{class:`whitespace-nowrap`},{default:M(()=>[...t[19]||=[U(`Locales to import`,-1)]]),_:1}),V(`span`,DP,k(b.value)+` of `+k(o.value.locales.length),1)]),V(`div`,OP,[(R(!0),z(L,null,F(o.value.locales,e=>(R(),B(j(Sb),{key:e},{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`button`,{type:`button`,disabled:e===s.value,class:O([`group inline-flex h-7 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border pl-1.5 pr-2 text-[12px] transition-colors`,e===s.value?`border-primary/40 bg-primary/10 cursor-default`:_(e)?`border-input bg-card text-foreground hover:bg-muted`:`border-dashed border-border bg-transparent text-muted-foreground hover:bg-muted/50`]),onClick:t=>v(e)},[H(FC,{code:e,size:14},null,8,[`code`]),V(`span`,AP,k(e),1),e===s.value?(R(),z(`span`,jP,`src`)):(R(),z(`span`,{key:1,class:O([`grid size-3.5 place-items-center rounded-[3px] border`,_(e)?`border-primary bg-primary text-primary-foreground`:`border-border text-transparent`])},[H(j(Du),{class:`size-2.5`,"stroke-width":3})],2))],10,kP)]),_:2},1024),H(j(ZS),null,{default:M(()=>[U(k(e===s.value?`Source language — always imported`:_(e)?`Click to exclude`:`Click to include`),1)]),_:2},1024)]),_:2},1024))),128))])]),o.value.sampleKeys.length?(R(),z(`div`,MP,[V(`div`,NP,[V(`button`,{type:`button`,class:`flex w-full items-center gap-2 px-3 py-2 text-[13px] text-muted-foreground transition-colors hover:bg-muted/50`,onClick:t[2]||=e=>l.value=!l.value},[H(j(ku),{class:O([`size-3.5 shrink-0 transition-transform`,l.value?`rotate-90`:``])},null,8,[`class`]),t[20]||=V(`span`,{class:`whitespace-nowrap`},`Preview sample keys`,-1),V(`span`,PP,k(g.value.glyph),1)]),l.value?(R(),z(`div`,FP,[(R(!0),z(L,null,F(o.value.sampleKeys,e=>(R(),z(`div`,{key:e.key,class:`flex items-baseline gap-3 px-3 py-1.5 text-[12px]`},[V(`span`,IP,k(e.key),1),V(`span`,LP,k(e.value),1)]))),128)),x.value>0?(R(),z(`div`,RP,` + `+k(x.value.toLocaleString())+` more keys `,1)):W(``,!0)])):W(``,!0)])])):W(``,!0)]),V(`div`,zP,[H(j(Q),{variant:`ghost`,size:`sm`,onClick:t[3]||=e=>r(`dismiss`)},{default:M(()=>[...t[21]||=[U(`Skip`,-1)]]),_:1}),H(j(Sb),null,{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`label`,BP,[vr(V(`input`,{type:`checkbox`,"data-testid":`cldr-toggle`,"onUpdate:modelValue":t[4]||=e=>p.value=e,class:`size-3.5 accent-primary`},null,512),[[Il,p.value]]),t[22]||=U(` Convert plurals to CLDR categories `,-1)])]),_:1}),H(j(ZS),{class:`max-w-xs`},{default:M(()=>[...t[23]||=[U(`Rewrite exact =N plural selectors (e.g. =1) into each language's CLDR plural categories, the way Crowdin does.`,-1)]]),_:1})]),_:1}),V(`div`,VP,[H(j(Q),{"data-testid":`import-btn`,disabled:b.value===0,onClick:S},{default:M(()=>[H(j(Ad),{class:`size-4`}),U(` Import `+k(b.value)+` `+k(b.value===1?`locale`:`locales`),1)]),_:1},8,[`disabled`])])])],64)):a.value===`importing`?(R(),z(L,{key:1},[H(j(cg),{class:`sr-only`},{default:M(()=>[...t[24]||=[U(`Importing translations`,-1)]]),_:1}),V(`div`,HP,[H(j($u),{class:`size-10 text-primary gf-spin`}),V(`div`,null,[t[25]||=V(`div`,{class:`text-sm font-semibold`},`Importing translations…`,-1),o.value?(R(),z(`div`,UP,` Reading `+k(o.value.keyCount.toLocaleString())+` keys across `+k(b.value)+` locales `,1)):W(``,!0)])])],64)):a.value===`done`&&d.value?(R(),z(L,{key:2},[V(`div`,WP,[V(`div`,GP,[V(`div`,KP,[H(j(Du),{class:`size-6`,"stroke-width":2.5})]),V(`div`,null,[H(j(cg),{class:`text-base font-semibold`},{default:M(()=>[...t[26]||=[U(`Import complete`,-1)]]),_:1}),H(j(rg),{class:`mt-1 text-[13px] text-muted-foreground`},{default:M(()=>[V(`span`,qP,k(d.value.keyCount.toLocaleString())+` keys`,1),t[27]||=U(` across `,-1),V(`span`,JP,k(d.value.localeCount)+` locales`,1),t[28]||=U(` imported. `,-1)]),_:1})])]),d.value.warnings.length?(R(),z(`div`,YP,[V(`button`,{type:`button`,class:`flex w-full items-center gap-2 px-3 py-2.5 text-left`,onClick:t[5]||=e=>u.value=!u.value},[H(j(Td),{class:`size-3.5 shrink-0 text-warning`}),V(`span`,XP,k(d.value.warnings.length)+` `+k(d.value.warnings.length===1?`warning`:`warnings`),1),t[29]||=V(`span`,{class:`whitespace-nowrap text-[12px] text-warning/70`},`· import still succeeded`,-1),H(j(ku),{class:O([`ml-auto size-3.5 shrink-0 text-warning transition-transform`,u.value?`rotate-90`:``])},null,8,[`class`])]),u.value?(R(),z(`ul`,ZP,[(R(!0),z(L,null,F(d.value.warnings,(e,t)=>(R(),z(`li`,{key:t,class:`px-3 py-2 text-[12px] text-muted-foreground`},k(e),1))),128))])):W(``,!0)])):W(``,!0)]),V(`div`,QP,[V(`div`,$P,[H(j(Q),{onClick:t[6]||=e=>r(`imported`)},{default:M(()=>[t[30]||=U(`Open editor `,-1),H(j(bu),{class:`size-4`})]),_:1})])])],64)):a.value===`error`?(R(),z(L,{key:3},[V(`button`,{type:`button`,class:`absolute right-3.5 top-3.5 z-10 grid h-7 w-7 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:t[7]||=e=>r(`dismiss`)},[H(j(kd),{class:`size-4`})]),V(`div`,eF,[V(`div`,tF,[V(`div`,nF,[H(j(Td),{class:`size-5`})]),V(`div`,rF,[H(j(cg),{class:`text-base font-semibold`},{default:M(()=>[...t[31]||=[U(`Couldn't import translations`,-1)]]),_:1}),H(j(rg),{class:`mt-1 text-[13px] text-muted-foreground`},{default:M(()=>[U(k(f.value),1)]),_:1})])])]),V(`div`,iF,[V(`div`,aF,[H(j(Q),{variant:`outline`,onClick:t[8]||=e=>r(`dismiss`)},{default:M(()=>[...t[32]||=[U(`Dismiss`,-1)]]),_:1})])])],64)):W(``,!0)]),_:1})]),_:1})]),_:1},8,[`open`]))}}),sF=`glotfile-theme`,cF=[`system`,`light`,`dark`],lF=e=>cF.includes(e);function uF(){let e=localStorage.getItem(sF);return lF(e)?e:`system`}var dF=window.matchMedia(`(prefers-color-scheme: dark)`),fF=A(dF.matches);dF.addEventListener(`change`,e=>{fF.value=e.matches});var pF=A(uF()),mF=K(()=>pF.value===`system`?fF.value:pF.value===`dark`);function hF(){document.documentElement.classList.toggle(`dark`,mF.value)}function gF(){N(mF,hF,{immediate:!0,flush:`sync`})}function _F(e){pF.value=e,localStorage.setItem(sF,e),tf({theme:e}).catch(()=>{})}async function vF(){try{let{theme:e}=await ef();lF(e)&&e!==pF.value&&(pF.value=e,localStorage.setItem(sF,e))}catch{}}var yF={class:`flex flex-col items-center gap-0.5 rounded-lg bg-black/15 p-0.5`},bF=[`data-mode`,`aria-label`,`aria-pressed`,`onClick`],xF=P({__name:`ThemeToggle`,setup(e){let t=[{value:`light`,label:`Light`,icon:xd},{value:`system`,label:`System`,icon:nd},{value:`dark`,label:`Dark`,icon:rd}];return(e,n)=>(R(),z(`div`,yF,[(R(),z(L,null,F(t,e=>H(j(Sb),{key:e.value},{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`button`,{type:`button`,"data-mode":e.value,"aria-label":e.label,"aria-pressed":j(pF)===e.value,class:O(j(eS)(`flex size-8 items-center justify-center rounded-md transition-colors`,j(pF)===e.value?`bg-primary text-primary-foreground`:`text-rail-foreground/70 hover:bg-white/10 hover:text-rail-foreground`)),onClick:t=>j(_F)(e.value)},[(R(),B(aa(e.icon),{class:`size-4`}))],10,bF)]),_:2},1024),H(j(ZS),{side:`right`},{default:M(()=>[U(k(e.label),1)]),_:2},1024)]),_:2},1024)),64))]))}}),SF=P({__name:`Kbd`,props:{class:{}},setup(e){return(e,t)=>(R(),z(`kbd`,{class:O(j(eS)(`inline-flex h-5 min-w-5 items-center justify-center rounded border bg-muted px-1.5 font-mono text-xs font-medium text-muted-foreground`,e.$props.class))},[I(e.$slots,`default`)],2))}}),CF=[{route:`editor`,keys:[`g`,`e`],label:`Editor`},{route:`analytics`,keys:[`g`,`a`],label:`Analytics`},{route:`glossary`,keys:[`g`,`g`],label:`Glossary`},{route:`screenshots`,keys:[`g`,`i`],label:`Screenshots`},{route:`settings`,keys:[`g`,`s`],label:`Settings`},{route:`activity`,keys:[`g`,`l`],label:`Activity`},{route:`docs`,keys:[`g`,`d`],label:`Docs`}];function wF(e,t){if(e.pending===`g`){let e=CF.find(e=>e.keys[1]===t);return{state:{pending:null},action:e?{type:`navigate`,route:e.route}:null}}return t===`g`?{state:{pending:`g`},action:null}:t===`?`?{state:{pending:null},action:{type:`toggleHelp`}}:{state:{pending:null},action:null}}var TF={class:`flex w-14 shrink-0 flex-col items-center gap-1 bg-rail py-3 text-rail-foreground`},EF=[`aria-label`,`onClick`],DF={key:0,class:`flex items-center gap-0.5`},OF={class:`mt-auto`},kF=P({__name:`NavRail`,setup(e){let t=Sp(),n=[{id:`editor`,label:`Editor`,icon:Zu},{id:`analytics`,label:`Analytics`,icon:Eu},{id:`glossary`,label:`Glossary`,icon:Tu},{id:`screenshots`,label:`Screenshots`,icon:Yu},{id:`settings`,label:`Settings`,icon:md},{id:`activity`,label:`Activity`,icon:fd},{id:`docs`,label:`Docs`,icon:Cu}].map(e=>({...e,keys:CF.find(t=>t.route===e.id)?.keys}));return(e,r)=>(R(),B(j(vb),{"delay-duration":300},{default:M(()=>[V(`nav`,TF,[r[0]||=V(`div`,{class:`mb-3 flex size-9 items-center justify-center rounded-md bg-primary font-mono text-base font-semibold text-primary-foreground`},` G `,-1),(R(!0),z(L,null,F(j(n),e=>(R(),B(j(Sb),{key:e.id},{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`button`,{type:`button`,"aria-label":e.label,class:O(j(eS)(`relative flex size-10 items-center justify-center rounded-md transition-colors`,j(t)===e.id?`bg-primary text-primary-foreground`:`text-rail-foreground/70 hover:bg-white/10 hover:text-rail-foreground`)),onClick:t=>j(xp)(e.id)},[(R(),B(aa(e.icon),{class:`size-5`}))],10,EF)]),_:2},1024),H(j(ZS),{side:`right`,class:`flex items-center gap-2`},{default:M(()=>[V(`span`,null,k(e.label),1),e.keys?(R(),z(`span`,DF,[(R(!0),z(L,null,F(e.keys,(e,t)=>(R(),B(SF,{key:t},{default:M(()=>[U(k(e),1)]),_:2},1024))),128))])):W(``,!0)]),_:2},1024)]),_:2},1024))),128)),V(`div`,OF,[H(xF)])])]),_:1}))}}),AF={class:`flex flex-col gap-1`},jF={class:`flex items-center gap-1`},MF={class:`flex items-center justify-between py-1 text-sm`},NF={class:`flex items-center gap-1`},PF=P({__name:`ShortcutsDialog`,props:{open:{type:Boolean,required:!0},openModifiers:{}},emits:[`update:open`],setup(e){let t=Za(e,`open`);return(e,n)=>(R(),B(j(bh),{open:t.value,"onUpdate:open":n[0]||=e=>t.value=e},{default:M(()=>[H(j(LS),{class:`max-w-sm`},{default:M(()=>[H(j(RS),null,{default:M(()=>[H(j(BS),null,{default:M(()=>[...n[1]||=[U(`Keyboard shortcuts`,-1)]]),_:1})]),_:1}),V(`ul`,AF,[(R(!0),z(L,null,F(j(CF),e=>(R(),z(`li`,{key:e.route,class:`flex items-center justify-between py-1 text-sm`},[V(`span`,null,k(e.label),1),V(`span`,jF,[(R(!0),z(L,null,F(e.keys,(e,t)=>(R(),B(SF,{key:t},{default:M(()=>[U(k(e),1)]),_:2},1024))),128))])]))),128)),V(`li`,MF,[n[3]||=V(`span`,null,`Search keys`,-1),V(`span`,NF,[H(SF,null,{default:M(()=>[...n[2]||=[U(`/`,-1)]]),_:1})])])])]),_:1})]),_:1},8,[`open`]))}}),FF=A(!1),IF=1e3;function LF(){let e={pending:null},t=null;function n(){t!==null&&(clearTimeout(t),t=null)}function r(r){if(r.metaKey||r.ctrlKey||r.altKey||r.repeat)return;let i=r.target;if(i&&(i.tagName===`INPUT`||i.tagName===`TEXTAREA`||i.isContentEditable))return;let a=r.key.toLowerCase(),o=!!document.querySelector(`[role="dialog"],[role="menu"],[role="listbox"]`),s=a===`?`&&FF.value;if(o&&!s)return;let c=wF(e,a);e=c.state,n(),e.pending===`g`&&(t=window.setTimeout(()=>{e={pending:null},t=null},IF));let{action:l}=c;l&&(l.type===`navigate`?xp(l.route):FF.value=!FF.value,r.preventDefault())}Ki(()=>window.addEventListener(`keydown`,r)),Xi(()=>{n(),window.removeEventListener(`keydown`,r)})}var RF={class:`flex h-screen bg-background text-foreground`},zF={class:`flex min-w-0 flex-1 flex-col`},BF={class:`flex h-12 shrink-0 items-center justify-between border-b px-4`},VF={class:`flex min-w-0 items-center gap-3`},HF={key:0,class:`flex min-w-0 items-center gap-1.5`},UF={class:`max-w-[12rem] shrink-0 truncate font-mono text-sm font-medium`},WF={class:`truncate`},GF={key:0,class:`text-muted-foreground`},KF={class:`text-sm font-semibold`},qF={class:`font-mono`},JF={class:`flex min-h-0 flex-1 flex-col overflow-hidden`},YF=P({__name:`App`,setup(e){let t=Sp();LF();let n=fn(null),r=A(null),i=A([]),a=K(()=>[...i.value].sort((e,t)=>{let n=e.relDir?`${e.relDir}/${e.name}`:e.name,r=t.relDir?`${t.relDir}/${t.name}`:t.name;return n.localeCompare(r)})),o=A(!1),s=A(null);async function c(){n.value=await jd()}Ki(async()=>{await c();try{[r.value,i.value]=await Promise.all([xf(),Sf()]),document.title=r.value.project?`${r.value.project} — Glotfile`:`Glotfile`}catch(e){$.error(e.message)}n.value&&Object.keys(n.value.keys).length===0&&(o.value=!0)});function l(){location.reload()}async function u(e){if(e!==r.value?.path)try{await Cf(e),location.reload()}catch(e){$.error(e.message)}}let d=K(()=>({editor:`Editor`,analytics:`Analytics`,glossary:`Glossary`,screenshots:`Screenshots`,settings:`Settings`,activity:`Activity`,docs:`Docs`})[t.value]),f=K(()=>{if(!n.value)return null;let{sourceLocale:e,locales:t}=n.value.config;return{source:e,targets:t.filter(t=>t!==e)}});return(e,n)=>(R(),B(j(vb),{"delay-duration":300},{default:M(()=>[V(`div`,RF,[H(kF),V(`div`,zF,[V(`header`,BF,[V(`div`,VF,[r.value?(R(),z(`div`,HF,[H(j(Sb),null,{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`span`,UF,k(r.value.project),1)]),_:1}),H(j(ZS),{side:`bottom`,class:`font-mono`},{default:M(()=>[U(k(r.value.dir),1)]),_:1})]),_:1}),H(j(ku),{class:`size-3.5 shrink-0 text-muted-foreground`}),H(j(by),null,{default:M(()=>[H(j(Ey),{"as-child":``},{default:M(()=>[H(j(Q),{variant:`outline`,size:`sm`,class:`max-w-[16rem] gap-1.5 font-mono`},{default:M(()=>[V(`span`,WF,k(r.value.name),1),H(j(Au),{class:`size-3.5 shrink-0 text-muted-foreground`})]),_:1})]),_:1}),H(j(HS),{align:`start`,class:`w-max`},{default:M(()=>[(R(!0),z(L,null,F(a.value,e=>(R(),B(j(US),{key:e.path,class:`font-mono`,onSelect:t=>u(e.path)},{default:M(()=>[H(j(Du),{class:O([`size-4 shrink-0`,e.path===r.value.path?`opacity-100`:`opacity-0`])},null,8,[`class`]),V(`span`,null,[e.relDir?(R(),z(`span`,GF,k(e.relDir)+`/`,1)):W(``,!0),U(k(e.name),1)])]),_:2},1032,[`onSelect`]))),128))]),_:1})]),_:1})])):W(``,!0),V(`h1`,KF,k(d.value),1)]),f.value?(R(),B(j(Sb),{key:0},{default:M(()=>[H(j(Db),{"as-child":``},{default:M(()=>[V(`button`,{type:`button`,class:`shrink-0 font-mono text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:n[0]||=e=>j(xp)(`settings`)},k(f.value.source)+` → `+k(f.value.targets.length)+` `+k(f.value.targets.length===1?`locale`:`locales`),1)]),_:1}),H(j(ZS),{side:`bottom`,class:`max-w-[28rem] leading-relaxed`},{default:M(()=>[V(`div`,qF,k(f.value.targets.join(`, `)||`—`),1),n[4]||=V(`div`,{class:`mt-1 text-background/60`},`Click to manage in Settings`,-1)]),_:1})]),_:1})):W(``,!0)]),V(`main`,JF,[j(t)===`editor`?(R(),B(bD,{key:0})):j(t)===`analytics`?(R(),B(mk,{key:1})):j(t)===`glossary`?(R(),B(Bk,{key:2})):j(t)===`screenshots`?(R(),B(mN,{key:3})):j(t)===`settings`?(R(),B(QM,{key:4})):j(t)===`activity`?(R(),B(VN,{key:5})):j(t)===`docs`?(R(),B(rP,{key:6})):W(``,!0)])]),H(j(AS)),H(PF,{open:j(FF),"onUpdate:open":n[1]||=e=>dn(FF)?FF.value=e:null},null,8,[`open`]),o.value?(R(),B(oF,{key:0,ref_key:`wizardRef`,ref:s,onVnodeMounted:n[2]||=e=>s.value?.init(),onDismiss:n[3]||=e=>o.value=!1,onImported:l},null,512)):W(``,!0)])]),_:1}))}});gF(),iu(YF).mount(`#app`),vF(),JE(),kw();