MidLang is a translation middleware that decouples translation resources from business data. Applications read and update translations through an HTTP API, while the same store can later be used for diagnostics, export, and offline artifacts.
MidLang is in early development. APIs, storage formats, and routes may still change.
- Serve translations online without bundling a frozen translation file into every application release.
- Keep one source of truth for online reads, writes, diagnostics, and future exports.
- Track missing translations as issues instead of losing them in logs.
- Record translation history through a per-key changelog.
- Measure locale coverage against a reference locale.
- Use the WebUI to inspect and manage translation resources.
The development command uses in-memory translation storage and an in-memory SQLite database, so it does not modify local data files:
cargo run -p midlang-server -- --store mem --sqlite-url sqlite::memory:The server listens on 127.0.0.1:4321 by default. On the first start, it
prints an administrator token once. Save the token before stopping the server.
Check that the service is running:
curl http://127.0.0.1:4321/healthThe interactive API documentation is available at
http://127.0.0.1:4321/docs, and the OpenAPI
document is available at
http://127.0.0.1:4321/openapi.json.
In another terminal:
cd web/midlang-webui
pnpm install
pnpm devThe console asks for the server URL and administrator token. Set
VITE_MIDLANG_REMOTE_URL in web/midlang-webui/.env.local if the server is
not running at the default URL.
Translation reads and writes use bearer-token authentication and permission-scoped tokens.
Read a translation:
curl \
-H "Authorization: Bearer <TOKEN>" \
http://127.0.0.1:4321/t/zh-CN/greeting.helloWrite a translation:
curl -X PUT \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"value":"你好,世界"}' \
http://127.0.0.1:4321/t/zh-CN/greeting.helloKeys can also be addressed with an explicit namespace:
/t/{locale}/{namespace}/{key}
The main translation permissions are:
translation:readtranslation:writetranslation:delete
See the generated API documentation at /docs for authentication, token
management, issues, changelog, coverage, and statistics endpoints.
application ── HTTP ──▶ midlang-server ──▶ midlang-core ──▶ translation store
│ └──────▶ diagnostics
└───────────────────────────▶ SQLite service data
crates/corecontains the translation domain logic, KV-store abstraction, memory/redb backends, and internal services.crates/servercontains the HTTP API, CLI, authentication, OpenAPI documentation, and service wiring.web/midlang-webuicontains the React/TypeScript administration console.web/midlang-docscontains the VitePress documentation site.
Storage responsibilities are intentionally separate:
- The KV store holds translation data. It supports
memfor development andredbfor persistent local storage. - SQLite holds service data such as authentication, issues, changelog, and coverage.
Run the smallest relevant check for a change. For a workspace-wide validation:
cargo fmt --all -- --check
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warningscd web/midlang-webui
pnpm lint
pnpm buildIf an API change affects the generated client, start the server and refresh it before building:
pnpm generate:apiThe detailed guide is in
web/midlang-docs. To run it locally:
cd web/midlang-docs
pnpm install
pnpm dev- Memory and redb translation stores
- Authenticated translation read, write, and delete endpoints
- Permission groups and bearer tokens
- Missing-key issues
- Per-key changelog
- Coverage against a reference locale
- Locale listing, store statistics, and OpenAPI/Swagger UI
- React administration console
- Deployment and packaging improvements
- Bulk import and export
- Versioned export artifacts and offline runtime
- SDKs
- Plural and ICU message support
MidLang is licensed under the GNU Affero General Public License v3.0.