Repository navigation
feat: Tolgee-compatible translation endpoints - #7
Merged
Merged
Conversation
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/.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.POST /v2/projects/{project}/translationsnullclears a translationPUT /v2/projects/{project}/translationsGET /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.apiorigin; resending an unchanged text keeps its reviewed state.keyId,keyName,keyNamespace,translationswithTRANSLATED/REVIEWED/UNTRANSLATED)./v2/gets the same CORS headers as/api/and a JSON 404 for unknown paths.Testing:
TestTolgeeCompatibleAPIcovers 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.