-
Notifications
You must be signed in to change notification settings - Fork 52
FEATURE: Translate categories with selected provider #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
translated_name = translator.translate_text!(category.name, target_locale_sym) | ||
translated_description = translator.translate_text!(category.description, target_locale_sym) | ||
|
||
category.update!(name: translated_name, description: translated_description) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that in a job we loop through locale, translate and then update name and description column. So if we have SiteSetting.automatic_translation_target_languages = "en|pl|de", only last locale translation will be saved.
Is it expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that in a job we loop through locale
In the job it loops category and locale:
categories.each do |category|
locales.each do |locale|
# invoke this translation method
end
end
Then this .translate
method translates for the specific category and locale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, fixed here #283
This feature introduces the ability to translate categories on core's CategoryLocalization from discourse/discourse#32380. This includes
Translator.translate
which takes in supported modelsCategoryTranslator
specific to categories, which uses the basic text translator introduced in DEV: Add the ability to translate a single piece of text #281Anyone can manually translate all categories using