ignore empty

This commit is contained in:
Nat 2025-06-06 15:24:50 +08:00
parent 7029f4d1aa
commit 5da8aa31e2
No known key found for this signature in database
GPG Key ID: 4938B35D927EC773
1 changed files with 5 additions and 2 deletions

View File

@ -9,9 +9,12 @@ module DiscourseAi
target_locale_sym = target_locale.to_s.sub("-", "_").to_sym target_locale_sym = target_locale.to_s.sub("-", "_").to_sym
translated_name = ShortTextTranslator.new(category.name, target_locale_sym).translate translated_name = ShortTextTranslator.new(category.name, target_locale_sym).translate
# category descriptions are first paragraphs of posts
translated_description = translated_description =
PostRawTranslator.new(category.description, target_locale_sym).translate if category.description.present?
PostRawTranslator.new(category.description, target_locale_sym).translate
else
""
end
localization = localization =
CategoryLocalization.find_or_initialize_by( CategoryLocalization.find_or_initialize_by(