feat: add Translate text button backed by translator microservice#40
Merged
OmerGursoy04 merged 2 commits intomainfrom Mar 27, 2026
Merged
feat: add Translate text button backed by translator microservice#40OmerGursoy04 merged 2 commits intomainfrom
OmerGursoy04 merged 2 commits intomainfrom
Conversation
…microservice Adds a translate action under each topic post and a new GET /api/v3/posts/:pid/translate backend route that calls the external translator service (TRANSLATOR_URL) with timeout and safe fallback to original text when unavailable.
Adds missing write API schema entry and path file for GET /api/v3/posts/{pid}/translate so route-to-schema parity tests pass in CI.
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.
Context
This PR adds a new “Translate text” action under each topic post so users can request English translation on demand. It introduces end-to-end wiring from the post UI to a new NodeBB API endpoint, and from that endpoint to the external translator microservice with safe fallback behavior.
Summary
GET /api/v3/posts/:pid/translateGET /api/v3/posts/:pid/translateGET ${TRANSLATOR_URL}/?content=<urlencoded text>LLM_TRANSLATE_TIMEOUT_MS(default5000)Files Changed
vendor/nodebb-theme-harmony-main/templates/partials/topic/post.tpl: add translate button + translation containervendor/nodebb-theme-harmony-2.1.35/templates/partials/topic/post.tpl: add translate button + translation containerpublic/src/client/topic/postTools.js: add post translate click handler and UI update logicsrc/routes/write/posts.js: addGET /:pid/translateroutesrc/controllers/write/posts.js: addPosts.getTranslationcontrollersrc/api/posts.js: implementpostsAPI.getTranslationwith microservice call + timeout + fallbackpublic/language/en-US/search.json: add translation UI stringspublic/language/en-GB/search.json: add translation UI stringspublic/language/en-x-pirate/search.json: add translation UI stringsTesting
[component="post/translate"]/:pid/translateManual Verification Steps
TRANSLATOR_URL=http://localhost:5001