Skip to content

Conversation

@nattsw
Copy link
Contributor

@nattsw nattsw commented May 7, 2025

With the introduction of Post.locale and PostLocalization in core, we want to use this plugin's translator provider to automatically detect and translate posts and save it into those tables.

Considerations: In a future PR we will also apply CookedPostProcessor to the cooked translations.

@nattsw nattsw requested a review from Copilot May 7, 2025 04:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces automatic translation functionality to detect and translate posts into Post and PostLocalization using the translator provider.

  • Adds tests in spec files to verify that translation jobs are enqueued or skipped based on settings.
  • Updates job logic to detect a post’s locale and translate into the configured target languages.
  • Enqueues the detect_translate_post job when a post is processed if experimental localization is enabled.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
spec/lib/automatic_translation_spec.rb Tests for enqueuing the detect_translate_post job upon post processing.
spec/jobs/detect_translate_post_spec.rb Verifies job execution logic under various configuration scenarios.
lib/discourse_translator/automatic_translations.rb Enqueues the detect_translate_post job when experimental content localization is enabled.
app/jobs/regular/detect_translate_post.rb Implements job logic to detect locale, iterate over target languages, and handle translation errors gracefully.

@nattsw nattsw merged commit 7c3bc25 into main May 7, 2025
6 checks passed
@nattsw nattsw deleted the job-event branch May 7, 2025 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants