Introducing a new way to review your PRs.

Read the announcement

generaltranslation / gt

Full-stack localization for every framework

View on GitHub

22 documents · Updated Nov 23, 2026

docs / locadex-operations

Locadex operations

Locadex operations provide the entry point and support layers for localization work. The locadex launcher sends an engineer to the General Translation dashboard for agent-led setup, while the paired gt CLI carries out project-aware translation work. Shared logs, prompts, project context, credentials, and shutdown handling make these workflows usable in local terminals and automated runs.

For the wider translation command lifecycle, see Translation operations. For the translation service boundary, see Translation API client. For related command workflows, see GTX command-line workflows, Sanity CMS integration, Payload CMS integration, Session recording localization, and Bundle analysis.

Operational model

The operational model separates user intent from translation work. Locadex starts an agent-assisted setup path in the dashboard, and the gt command selects a project-aware CLI for the detected application type.

Locadex entry point

The Locadex CLI is a small launcher for an AI agent that automates internationalization work in complex codebases. Its start command shows the Locadex context, opens the Locadex dashboard in the user's browser, and prints the same link when a browser cannot open it automatically. The launcher loads local environment files before it starts the command flow. packages/…/cli.ts• L3-9 packages/…/cli.ts• L22-48

The dashboard handoff is the product boundary for agent-led work. The CLI does not perform repository changes in this path. It directs the engineer to the service that can connect to the repository and continue setup.

The published package is at version 1.0.263, and its latest release updates the paired gt CLI to 2.28.4. It declares gt as a workspace dependency so the launcher and translation command layer are released as a coordinated product surface. packages/…/package.json• L1-20 packages/…/CHANGELOG.md• L3-8

References: packages/…/cli.ts• L22-48 packages/…/package.json• L1-20 packages/…/CHANGELOG.md• L3-8

Translation command surface

The gt CLI is the local control surface for translation operations. It detects the project library and creates a matching command handler so the same high-level workflow can serve Next.js, React, Vue, Node, Python, and other supported projects. packages/…/index.ts• L11-40

The main commands map to distinct operator goals:

CommandOperational goal
initConfigure a project and guide the engineer through setup.
configureCreate or update the project translation configuration.
setupSubmit source files and prepare the project for translation.
stageSubmit work that requires human approval before translation.
enqueueSend selected files for translation.
translateRun the normal translation path or complete a staged download path.
downloadRetrieve translations that were staged earlier.
validateCheck source dictionaries and inline content for translation issues.
generateCreate source translation data for teams that manage translations themselves.
upload and save-localMove source, translation, or local edit data between the project and the platform.
authObtain project credentials through the dashboard.
git setupConfigure Git handling for generated translation files.

The command set is assembled in layers. Shared commands establish common project and platform actions, while inline project handlers add source scanning, validation, and source-template work. packages/…/base.ts• L150-214 packages/…/base.ts• L216-308

References: packages/…/index.ts• L11-40 packages/…/base.ts• L150-214 packages/…/inline.ts• L23-38

Translation workflow stages

The normal translation path turns project settings into a controlled sequence of source preparation, platform submission, result retrieval, local post-processing, and summary output. A staged project changes the middle of this path: one command submits work for approval and a later command downloads the approved result. packages/…/base.ts• L489-537

This sequence keeps approval-sensitive work separate from immediate translation. It also gives the CLI a place to handle localization follow-up work after download, such as updating generated references, mirroring shared assets, and clearing run state.

The following diagram shows the operator-facing path from a command to local project output.

flowchart LR
    A[CLI command] --> B[Load project settings]
    B --> C{Staged workflow?}
    C -->|No| D[Prepare and submit source]
    D --> E[Translate and retrieve results]
    C -->|Yes| F[Stage for approval]
    F --> G[Download approved results]
    E --> H[Local post-processing]
    G --> H
    H --> I[Update project files and report status]

References: packages/…/base.ts• L447-537 packages/…/stage.ts• L1-94 packages/…/download.ts• L1-133

Operator feedback

Operator feedback has two jobs: show progress in a human terminal and preserve useful records for scripts or support work. The current CLI logger provides one shared service for both jobs.

Log channels

The CLI logger supports default terminal output and JSON output. It also supports a separate JSON file stream when GT_LOG_FILE is set. GT_LOG_LEVEL limits the recorded level, while GT_LOG_FORMAT selects the console form. Each structured record receives a log ID so a run can be traced across messages. packages/…/logger.ts• L44-58 packages/…/logger.ts• L128-195

Quiet mode is for low-noise command use. It hides informational console output and terminal progress while warnings and errors remain visible. It does not turn off an explicitly requested log file, so an automated run can stay quiet on screen and still keep its record. packages/…/logger.ts• L204-221 packages/…/logger.ts• L227-336

Command boundaries are also logged. This lets a file log show when an operation starts and ends even when the terminal uses a compact or quiet presentation. packages/…/logger.ts• L364-387

References: packages/…/logger.ts• L44-58 packages/…/logger.ts• L128-195 packages/…/logger.ts• L204-221 packages/…/logger.ts• L364-393

Interactive prompts

Prompt helpers give setup and translation commands a common way to ask for locales, file patterns, choices, and confirmation. They validate user input where the workflow needs a known locale or a required selection. A cancelled prompt is treated as a clean operator exit rather than as a partial answer. packages/…/logging.ts• L138-223 packages/…/logging.ts• L248-355

The CLI uses an Ink prompt path when the terminal supports it. It falls back to Clack prompts when Ink is disabled or when the process is not attached to both an input and output TTY. This keeps the same command intent available in local terminals and non-interactive environments. packages/…/logging.ts• L26-47 packages/…/terminalSession.ts• L41-47

References: packages/…/logging.ts• L26-47 packages/…/logging.ts• L138-223 packages/…/logging.ts• L248-355 packages/…/terminalSession.ts• L41-47

Terminal lifecycle

Terminal lifecycle support prevents an active spinner or prompt from corrupting later log lines. The logger ends the active terminal session before it writes messages or changes progress UI, and cleanup also runs for normal process exit and common termination signals. packages/…/logger.ts• L16-42 packages/…/logger.ts• L227-362 packages/…/terminalSession.ts• L6-39

Shutdown handlers run once in reverse registration order. Each handler has a time limit, and a handler error is logged while the process continues toward its final exit. This gives network, prompt, and file resources a chance to close without allowing a stuck cleanup task to hold the CLI forever. packages/…/shutdown.ts• L11-20 packages/…/shutdown.ts• L23-75

References: packages/…/logger.ts• L16-42 packages/…/terminalSession.ts• L6-39 packages/…/shutdown.ts• L11-75

Project and credential utilities

The utility layer supplies the context that makes a command safe to run in a real project. It resolves package and version information, manages the dashboard credential handoff, and provides stable paths for the launcher itself.

Project context

Project setup uses the current working directory as its main context. Package metadata tells the CLI whether a project has the needed runtime or package manager support, and it also lets setup work in projects that do not have a JavaScript package file. packages/…/packageJson.ts• L9-41 packages/…/packageJson.ts• L62-100

The base command layer uses this context to reject setup at unsupported boundaries such as a monorepo workspace root or an Electron target. That check protects project configuration from being written at the wrong scope. packages/…/base.ts• L91-117

References: packages/…/packageJson.ts• L9-41 packages/…/packageJson.ts• L62-100 packages/…/base.ts• L91-117

Credential setup

Credential setup links the local CLI to the General Translation dashboard without asking the engineer to paste keys into the terminal. The CLI creates a short-lived dashboard session, opens the session in a browser, waits for the dashboard response, and removes the completed session. packages/…/credentials.ts• L19-81 packages/…/credentials.ts• L84-97

After the dashboard returns credentials, the CLI writes the project ID and keys to .env.local. It creates or updates the ignore rule for that file so the local secret store is not added to source control. Framework-specific public prefixes are applied when the runtime needs them. packages/…/credentials.ts• L99-169

The Locadex setup choice uses a separate dashboard URL for the GitHub connection. It opens that URL and leaves the rest of the agent setup to the dashboard service. packages/…/setupFlow.ts• L5-17

References: packages/…/credentials.ts• L19-97 packages/…/credentials.ts• L99-169 packages/…/setupFlow.ts• L5-17

Path and version context

The Locadex package resolves paths from its installed package root instead of from the caller's working directory. This lets the launcher read its own package metadata and display a reliable version in its header. Missing or unreadable metadata produces an unknown version rather than blocking the launch. packages/…/getPaths.ts• L1-21 packages/…/console.ts• L53-58

The translation CLI uses generated package version data for its own header. Together, these helpers keep operator messages tied to the tool version that is running. packages/…/packageJson.ts• L43-45 packages/…/logging.ts• L69-109

References: packages/…/getPaths.ts• L1-21 packages/…/console.ts• L53-58 packages/…/packageJson.ts• L43-45 packages/…/logging.ts• L69-109

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the Locadex launcher URL, dashboard handoff text, and setup-flow URL aligned with the dashboard routes that receive the user.
  • Keep the command descriptions and the selected project CLI in sync so framework detection does not expose a command with the wrong source behavior.
  • Preserve the relationship between quiet mode, console output, progress UI, and file logging. A change to one channel can silently hide operator evidence in another.
  • Keep prompt cancellation and terminal cleanup on the same exit paths. Interactive UI must close before a command writes its final status.
  • Keep credential names, framework prefixes, .env.local handling, and ignore-file behavior aligned with the runtime that reads them.
  • Keep package-root version lookup separate from project-working-directory lookup. Mixing these roots can produce wrong version output or write setup data to the wrong project.
  • Keep the published Locadex package and its gt dependency release versions aligned. The package exposes gt as a workspace dependency, so a launcher release can change the translation command layer even when the dashboard handoff does not change.

Important failure modes

TriggerConsequenceGuard
GT_LOG_FORMAT or GT_LOG_LEVEL has an unsupported valueThe CLI exits before it can run the requested command.Use default or json for format and debug, info, warn, or error for level.
--quiet is used when an operator expects progress UIInformational messages, spinners, and progress bars do not appear on the console.Use the file log when a record is needed, or omit quiet mode for an interactive run.
Setup runs from a workspace root or an Electron projectThe wizard refuses to configure the target because the project scope is not supported.Run setup from the specific application directory and use the supported framework path.
The dashboard does not return credentials within the wait periodAuthentication stops with a timeout and no credentials are saved.Complete the browser flow and check the printed dashboard link before retrying.
A prompt is cancelled or the process receives a termination signalThe current operation exits rather than continuing with an incomplete choice.Treat cancellation as an intentional stop and let terminal and shutdown cleanup run.
Locadex and gt package versions are released out of stepThe launcher can expose translation behavior that differs from the expected command layer.Treat the gt dependency update as part of the Locadex release contract.

Key files

FileWhy to read it
packages/…/cli.tsShows the Locadex launcher and its dashboard handoff.
packages/…/package.jsonShows the public executable, package version, and link to the gt CLI.
packages/…/CHANGELOG.mdShows the release history and the current gt dependency update.
packages/…/console.tsShows Locadex headers, prompts, progress UI, and exit messaging.
packages/…/logger.tsShows the Locadex logging facade and file recording behavior.
packages/…/shutdown.tsShows the Locadex process-stop contract.
packages/…/index.tsShows how project detection selects the CLI behavior.
packages/…/base.tsShows the shared command surface and the high-level translation flow.
packages/…/inline.tsShows commands for inline content and source translation data.
packages/…/logger.tsShows console formats, levels, quiet mode, file logs, and progress behavior.
packages/…/logging.tsShows shared headers, prompts, warnings, and exit handling.
packages/…/terminalSession.tsShows terminal cleanup and interactive-mode selection.
packages/…/credentials.tsShows the dashboard credential exchange and local secret-file setup.
packages/…/setupFlow.tsShows how gt init hands GitHub-based Locadex setup to the dashboard.