incubator-answer icon indicating copy to clipboard operation
incubator-answer copied to clipboard

Support AI translation for question and answer

Open hgaol opened this issue 2 months ago • 4 comments

Feature request

Add AI-assisted translation for question and answer drafts.

Requirements

  • Allow users to translate question titles and content before submission.
  • Allow users to translate answer content before submission.
  • Preserve Markdown, code blocks, URLs, HTML, mentions, and placeholders.
  • Use the configured AI provider, model, and site language.
  • Provide an administrator setting to enable or disable translation.
  • Handle provider errors with actionable messages.
  • Keep translation opt-in at the editor level so users can review the generated draft before replacing their content.

hgaol avatar Sep 12 '26 08:09 hgaol

/assign

Adarsh-Me avatar Sep 12 '26 08:09 Adarsh-Me

Hi, I have some suggestions regarding the style and interaction:

  1. Make the translation a small button placed at the end of the form.

  2. Only display it when the input text does not match the target language.

  3. After clicking, automatically replace the current form content with the translated text; there is no need for a modal to confirm, as the <input> have a built-in undo function.

design file

Image

fenbox avatar Sep 20 '26 03:09 fenbox

Hi @fenbox , thanks for the careful review and valuable feedback! Updated the PR to align with your suggestions.

  • Added compact, Figma-aligned translation icons to title inputs and editor bottom-right corners.
  • Shows “Translate into [language]” as the tooltip and accessible label.
  • Added deterministic client-side language detection using franc-min.
  • Shows the translation icon only when the input confidently differs from the site language.
  • Handles short cross-script text and avoids guessing ambiguous same-script text.
  • Ignores Markdown, code, URLs, HTML, mentions, and placeholders during detection.
  • Debounces detection and lazy-loads franc-min.
  • Removed the review modal.
  • Translation now immediately replaces the relevant field while preserving undo/edit behavior.
  • Added bottomRightAction to the editor to position the icon correctly.
  • Added six language-detection tests.

hgaol avatar Sep 20 '26 08:09 hgaol

Great news! Thank you for suggesting this feature. AI-assisted translation would be a valuable addition to Apache Answer, especially for multilingual communities. The ability to translate drafts while preserving Markdown, code blocks, URLs, and formatting would significantly improve accessibility and user experience. Looking forward to seeing this feature implemented!

Thank You

ssheryathakur avatar Nov 02 '26 21:11 ssheryathakur