mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-07-12 17:13:29 +00:00
DEV: Remove 'experimental' from translation features (#1439)
* DEV: Remove 'experimental' from translation features * include compat * include compat
This commit is contained in:
parent
cd14b0c0be
commit
3e87e92631
@ -1,3 +1,4 @@
|
||||
< 3.5.0.beta7-dev: cd14b0c0bee0cf63c59b64b6f7213e31a37f11a7
|
||||
< 3.5.0.beta6-dev: 3e74eea1e5e3143888d67a8d8a11206df214dc24
|
||||
< 3.5.0.beta3-dev: 09a68414804a1447f52e5d60691ba59742cda9ec
|
||||
< 3.5.0.beta2-dev: de8624416a15b3d8e7ad350b083cc1420451ccec
|
||||
|
@ -36,7 +36,7 @@ module Jobs
|
||||
end
|
||||
end
|
||||
|
||||
locales = SiteSetting.experimental_content_localization_supported_locales.split("|")
|
||||
locales = SiteSetting.content_localization_supported_locales.split("|")
|
||||
return if locales.blank?
|
||||
|
||||
locales.each do |locale|
|
||||
|
@ -34,7 +34,7 @@ module Jobs
|
||||
end
|
||||
end
|
||||
|
||||
locales = SiteSetting.experimental_content_localization_supported_locales.split("|")
|
||||
locales = SiteSetting.content_localization_supported_locales.split("|")
|
||||
return if locales.blank?
|
||||
|
||||
locales.each do |locale|
|
||||
|
@ -11,7 +11,7 @@ module Jobs
|
||||
return if !SiteSetting.discourse_ai_enabled
|
||||
return if !SiteSetting.ai_translation_enabled
|
||||
|
||||
locales = SiteSetting.experimental_content_localization_supported_locales.split("|")
|
||||
locales = SiteSetting.content_localization_supported_locales.split("|")
|
||||
return if locales.blank?
|
||||
|
||||
cat_id = args[:from_category_id] || Category.order(:id).first&.id
|
||||
|
@ -11,7 +11,7 @@ module Jobs
|
||||
return if !SiteSetting.discourse_ai_enabled
|
||||
return if !SiteSetting.ai_translation_enabled
|
||||
|
||||
locales = SiteSetting.experimental_content_localization_supported_locales.split("|")
|
||||
locales = SiteSetting.content_localization_supported_locales.split("|")
|
||||
return if locales.blank?
|
||||
|
||||
limit = args[:limit] || BATCH_SIZE
|
||||
|
@ -11,7 +11,7 @@ module Jobs
|
||||
return if !SiteSetting.discourse_ai_enabled
|
||||
return if !SiteSetting.ai_translation_enabled
|
||||
|
||||
locales = SiteSetting.experimental_content_localization_supported_locales.split("|")
|
||||
locales = SiteSetting.content_localization_supported_locales.split("|")
|
||||
return if locales.blank?
|
||||
|
||||
limit = args[:limit] || BATCH_SIZE
|
||||
|
@ -8,7 +8,7 @@ module Jobs
|
||||
def execute(args)
|
||||
return if !SiteSetting.discourse_ai_enabled
|
||||
return if !SiteSetting.ai_translation_enabled
|
||||
return if SiteSetting.experimental_content_localization_supported_locales.blank?
|
||||
return if SiteSetting.content_localization_supported_locales.blank?
|
||||
|
||||
Jobs.enqueue(:localize_categories)
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ module Jobs
|
||||
return if !SiteSetting.discourse_ai_enabled
|
||||
return if !SiteSetting.ai_translation_enabled
|
||||
|
||||
return if SiteSetting.experimental_content_localization_supported_locales.blank?
|
||||
return if SiteSetting.content_localization_supported_locales.blank?
|
||||
return if SiteSetting.ai_translation_backfill_rate == 0
|
||||
|
||||
Jobs.enqueue(:localize_posts, limit: SiteSetting.ai_translation_backfill_rate)
|
||||
|
@ -9,7 +9,7 @@ module Jobs
|
||||
return if !SiteSetting.discourse_ai_enabled
|
||||
return if !SiteSetting.ai_translation_enabled
|
||||
|
||||
return if SiteSetting.experimental_content_localization_supported_locales.blank?
|
||||
return if SiteSetting.content_localization_supported_locales.blank?
|
||||
return if SiteSetting.ai_translation_backfill_rate == 0
|
||||
|
||||
Jobs.enqueue(:localize_topics, limit: SiteSetting.ai_translation_backfill_rate)
|
||||
|
@ -12,7 +12,7 @@ describe Jobs::DetectTranslatePost do
|
||||
SiteSetting.public_send("ai_translation_model=", "custom:#{fake_llm.id}")
|
||||
end
|
||||
SiteSetting.ai_translation_enabled = true
|
||||
SiteSetting.experimental_content_localization_supported_locales = locales.join("|")
|
||||
SiteSetting.content_localization_supported_locales = locales.join("|")
|
||||
end
|
||||
|
||||
it "does nothing when translator is disabled" do
|
||||
@ -55,7 +55,7 @@ describe Jobs::DetectTranslatePost do
|
||||
end
|
||||
|
||||
it "does not translate when no target languages are configured" do
|
||||
SiteSetting.experimental_content_localization_supported_locales = ""
|
||||
SiteSetting.content_localization_supported_locales = ""
|
||||
DiscourseAi::Translation::PostLocaleDetector.expects(:detect_locale).with(post).returns("en")
|
||||
DiscourseAi::Translation::PostLocalizer.expects(:localize).never
|
||||
|
||||
|
@ -12,7 +12,7 @@ describe Jobs::DetectTranslateTopic do
|
||||
SiteSetting.public_send("ai_translation_model=", "custom:#{fake_llm.id}")
|
||||
end
|
||||
SiteSetting.ai_translation_enabled = true
|
||||
SiteSetting.experimental_content_localization_supported_locales = locales.join("|")
|
||||
SiteSetting.content_localization_supported_locales = locales.join("|")
|
||||
end
|
||||
|
||||
it "does nothing when translator is disabled" do
|
||||
@ -55,7 +55,7 @@ describe Jobs::DetectTranslateTopic do
|
||||
end
|
||||
|
||||
it "does not translate when no target languages are configured" do
|
||||
SiteSetting.experimental_content_localization_supported_locales = ""
|
||||
SiteSetting.content_localization_supported_locales = ""
|
||||
DiscourseAi::Translation::TopicLocaleDetector.expects(:detect_locale).with(topic).returns("en")
|
||||
DiscourseAi::Translation::TopicLocalizer.expects(:localize).never
|
||||
|
||||
|
@ -15,7 +15,7 @@ describe Jobs::LocalizeCategories do
|
||||
SiteSetting.public_send("ai_translation_model=", "custom:#{fake_llm.id}")
|
||||
end
|
||||
SiteSetting.ai_translation_enabled = true
|
||||
SiteSetting.experimental_content_localization_supported_locales = "pt|zh_CN"
|
||||
SiteSetting.content_localization_supported_locales = "pt|zh_CN"
|
||||
|
||||
Jobs.run_immediately!
|
||||
end
|
||||
@ -37,7 +37,7 @@ describe Jobs::LocalizeCategories do
|
||||
end
|
||||
|
||||
it "does nothing when no target languages are configured" do
|
||||
SiteSetting.experimental_content_localization_supported_locales = ""
|
||||
SiteSetting.content_localization_supported_locales = ""
|
||||
|
||||
DiscourseAi::Translation::CategoryLocalizer.expects(:localize).never
|
||||
|
||||
|
@ -12,7 +12,7 @@ describe Jobs::LocalizePosts do
|
||||
SiteSetting.public_send("ai_translation_model=", "custom:#{fake_llm.id}")
|
||||
end
|
||||
SiteSetting.ai_translation_enabled = true
|
||||
SiteSetting.experimental_content_localization_supported_locales = locales.join("|")
|
||||
SiteSetting.content_localization_supported_locales = locales.join("|")
|
||||
end
|
||||
|
||||
it "does nothing when translator is disabled" do
|
||||
@ -30,7 +30,7 @@ describe Jobs::LocalizePosts do
|
||||
end
|
||||
|
||||
it "does nothing when no target languages are configured" do
|
||||
SiteSetting.experimental_content_localization_supported_locales = ""
|
||||
SiteSetting.content_localization_supported_locales = ""
|
||||
DiscourseAi::Translation::PostLocalizer.expects(:localize).never
|
||||
|
||||
job.execute({})
|
||||
@ -136,7 +136,7 @@ describe Jobs::LocalizePosts do
|
||||
fab!(:group_pm_topic) { Fabricate(:group_private_message_topic, recipient_group: group) }
|
||||
fab!(:group_pm_post) { Fabricate(:post, topic: group_pm_topic, locale: "es") }
|
||||
|
||||
before { SiteSetting.experimental_content_localization_supported_locales = "ja" }
|
||||
before { SiteSetting.content_localization_supported_locales = "ja" }
|
||||
|
||||
context "when ai_translation_backfill_limit_to_public_content is true" do
|
||||
before { SiteSetting.ai_translation_backfill_limit_to_public_content = true }
|
||||
@ -187,7 +187,7 @@ describe Jobs::LocalizePosts do
|
||||
|
||||
before do
|
||||
SiteSetting.ai_translation_backfill_max_age_days = 5
|
||||
SiteSetting.experimental_content_localization_supported_locales = "ja"
|
||||
SiteSetting.content_localization_supported_locales = "ja"
|
||||
end
|
||||
|
||||
it "only processes posts within the age limit" do
|
||||
|
@ -12,7 +12,7 @@ describe Jobs::LocalizeTopics do
|
||||
SiteSetting.public_send("ai_translation_model=", "custom:#{fake_llm.id}")
|
||||
end
|
||||
SiteSetting.ai_translation_enabled = true
|
||||
SiteSetting.experimental_content_localization_supported_locales = locales.join("|")
|
||||
SiteSetting.content_localization_supported_locales = locales.join("|")
|
||||
end
|
||||
|
||||
it "does nothing when translator is disabled" do
|
||||
@ -30,7 +30,7 @@ describe Jobs::LocalizeTopics do
|
||||
end
|
||||
|
||||
it "does nothing when no target languages are configured" do
|
||||
SiteSetting.experimental_content_localization_supported_locales = ""
|
||||
SiteSetting.content_localization_supported_locales = ""
|
||||
DiscourseAi::Translation::TopicLocalizer.expects(:localize).never
|
||||
|
||||
job.execute({})
|
||||
@ -139,7 +139,7 @@ describe Jobs::LocalizeTopics do
|
||||
Fabricate(:group_private_message_topic, recipient_group: Fabricate(:group), locale: "es")
|
||||
end
|
||||
|
||||
before { SiteSetting.experimental_content_localization_supported_locales = "ja" }
|
||||
before { SiteSetting.content_localization_supported_locales = "ja" }
|
||||
|
||||
context "when ai_translation_backfill_limit_to_public_content is true" do
|
||||
before { SiteSetting.ai_translation_backfill_limit_to_public_content = true }
|
||||
|
@ -3,7 +3,7 @@
|
||||
describe Jobs::PostLocalizationBackfill do
|
||||
before do
|
||||
SiteSetting.ai_translation_backfill_rate = 100
|
||||
SiteSetting.experimental_content_localization_supported_locales = "en"
|
||||
SiteSetting.content_localization_supported_locales = "en"
|
||||
Fabricate(:fake_model).tap do |fake_llm|
|
||||
SiteSetting.public_send("ai_translation_model=", "custom:#{fake_llm.id}")
|
||||
end
|
||||
@ -29,7 +29,7 @@ describe Jobs::PostLocalizationBackfill do
|
||||
it "does not enqueue psot translation if backfill languages are not set" do
|
||||
SiteSetting.discourse_ai_enabled = true
|
||||
SiteSetting.ai_translation_enabled = true
|
||||
SiteSetting.experimental_content_localization_supported_locales = ""
|
||||
SiteSetting.content_localization_supported_locales = ""
|
||||
|
||||
described_class.new.execute({})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user