mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-08-02 11:23:27 +00:00
This commit - normalizes locales like en_GB and variants to en. With this, the feature will not translate en_GB posts to en (or similarly pt_BR to pt_PT) - consolidates whether the feature is enabled in `DiscourseAi::Translation.enabled?` - similarly for backfill in `DiscourseAi::Translation.backfill_enabled?` - turns off backfill if `ai_translation_backfill_max_age_days` is 0 to keep true to what it says. Set it to a high number to backfill everything
16 lines
356 B
Ruby
16 lines
356 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class CategoryLocalizationBackfill < ::Jobs::Scheduled
|
|
every 1.hour
|
|
cluster_concurrency 1
|
|
|
|
def execute(args)
|
|
return if !DiscourseAi::Translation.backfill_enabled?
|
|
limit = SiteSetting.ai_translation_backfill_hourly_rate
|
|
|
|
Jobs.enqueue(:localize_categories, limit:)
|
|
end
|
|
end
|
|
end
|