Skip to content

feat: Tolgee-compatible translation endpoints - #7

Merged
FabioHAraujo merged 1 commit into
mainfrom
feat/tolgee-compat
Oct 23, 2026
Merged

FabioHAraujo merged 1 commit into
mainfrom
feat/tolgee-compat

Conversation

@FabioHAraujo

Copy link
Copy Markdown
Contributor

Lets apps written for Tolgee's REST API switch to LowLex by changing only the base URL, project and API key. Platify's backend (UpsertTranslationKey) and its import script are the first users.

Tolgee endpoint LowLex
POST /v2/projects/{project}/translations Creates the key when missing and sets its texts; empty or null clears a translation
PUT /v2/projects/{project}/translations Updates existing keys only (404 otherwise)
GET /v2/projects/{project}/translations/{languages} {"en": {…}, "pt-BR": {…}}, nested on dots; ns, structureDelimiter, filterTag
  • {project} is a LowLex slug or id. The paths without it (/v2/projects/translations…) use the API key's project.
  • Usual project permissions apply: read keys cannot write, translators cannot create keys, and reviewed texts stay locked.
  • Texts get the api origin; resending an unchanged text keeps its reviewed state.
  • Responses follow Tolgee's shape (keyId, keyName, keyNamespace, translations with TRANSLATED/REVIEWED/UNTRANSLATED).
  • /v2/ gets the same CORS headers as /api/ and a JSON 404 for unknown paths.

Testing: TestTolgeeCompatibleAPI covers create, update, clear, PUT on a missing key, slug, numeric id and key-implied project, permissions, unknown languages, and the GET formats. The full suite passes.

Code written for Tolgee's REST API keeps working after a move to LowLex
with only a new base URL, project and API key:

- POST /v2/projects/{project}/translations creates the key when missing
  and sets its texts; an empty or null text clears a translation.
- PUT on the same path updates existing keys only (404 otherwise).
- GET /v2/projects/{project}/translations/{languages} returns
  {"en": {...}, ...}, nested on dots, with ns, structureDelimiter and
  filterTag as in Tolgee.

{project} is a LowLex slug or id; without it the API key's project is
used. Usual project permissions apply, texts get the "api" origin, and an
unchanged text keeps its reviewed state. /v2/ answers CORS like /api/.
@FabioHAraujo
FabioHAraujo merged commit 605a0a6 into main Oct 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant