Select Enable API and search for Google Cloud Translator API. Look for the enable button and click it to enable the API. Note that there is no free tier for the Google Translator API so it may prompt you to enable billing.
Once youāre done, click on credentials in the left menu
Click create credentials and select API key. Copy the API Key and paste it into the translator google api key site setting in Discourse.
In Discourse, under Admin > Settings > Basic Setup, enable allow user locale.
Settings
Name
Description
translator enabled
Allow inline translation of posts.
translator
The provider of the translation service.
translator azure subscription key
Azure Subscription Key
translator azure region
Azure Region
translator azure custom subdomain
Required if using a Virtual Network or Firewall for Azure Cognitive Services. Note: Only enter the custom subdomain not the full custom endpoint.
translator aws region
AWS Region
translator aws key id
AWS Key ID
translator aws secret access
AWS secret access key
translator aws iam role
AWS IAM Role
translator google api key
Google API Key
translator yandex api key
Yandex API Key
translator libretranslate endpoint
LibreTranslate Endpoint
translator libretranslate api key
LibreTranslate API Key
max translations per minute
The number of translations per minute a regular user can perform.
restrict translation by group
Only allowlisted groups can translate
restrict translation by poster group
Only allow translation of posts made by allowlisted users
Known Issues
Does not translate text within polls generated by discourse-poll plugin.
Images are enlarged upon translating.
Hosted by us? This plugin is available on our Enterprise plan.
Iām using LibreTranslate self-hosted which has worked well in the past, but Iām now getting a lot of repeated āJob exception: The translator service is currently not availableā errors. Iāve checked the URL which has been working OK in the past. If I access the URL then the LibreTranslate web page displays. Thereās no API/token required because my LibreTranslate instance is private with no access from the Internet.
The backtrace shows:
Message (548 copies reported)
Job exception: The translator service is currently not available.
Backtrace
/var/www/discourse/plugins/discourse-translator/services/discourse_translator/libretranslate.rb:168:in `result'
/var/www/discourse/plugins/discourse-translator/services/discourse_translator/libretranslate.rb:85:in `detect'
/var/www/discourse/plugins/discourse-translator/plugin.rb:120:in `block in execute'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/plugins/discourse-translator/plugin.rb:119:in `execute'
/var/www/discourse/app/jobs/base.rb:305:in `block (2 levels) in perform'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.0.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.0.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
/var/www/discourse/app/jobs/base.rb:292:in `block in perform'
/var/www/discourse/app/jobs/base.rb:288:in `each'
/var/www/discourse/app/jobs/base.rb:288:in `perform'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:202:in `execute_job'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:170:in `block (2 levels) in process'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/middleware/chain.rb:177:in `block in invoke'
/var/www/discourse/lib/sidekiq/pausable.rb:132:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/middleware/chain.rb:179:in `block in invoke'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/middleware/chain.rb:182:in `invoke'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:169:in `block in process'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:136:in `block (6 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/job_retry.rb:113:in `local'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:135:in `block (5 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq.rb:44:in `block in <module:Sidekiq>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:131:in `block (4 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:263:in `stats'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:126:in `block (3 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/job_logger.rb:13:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:125:in `block (2 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/job_retry.rb:80:in `global'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:124:in `block in dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/job_logger.rb:39:in `prepare'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:123:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:168:in `process'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:78:in `process_one'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/processor.rb:68:in `run'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/component.rb:8:in `watchdog'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sidekiq-6.5.12/lib/sidekiq/component.rb:17:in `block in safe_thread'
āHindiā locale option isnāt available in āDiscourseā yet. But āHindiā translation is available by different services (Iām using āMicrosoft Azureā).
Then how can we setup to translate all/any non-Hindi post into āHindiā even when discourse interface continues to be in English? Is this even possible?
I was thinking about adding this translator to our forum. However, I have two main concerns:
1. Is it possible to alter the translations?
I want to ensure that certain terms are translated in a specific way. For this, I need the ability to view the available translations and make changes if necessary.
2. When will a post be āre-translatedā?
Some forum posts are edited quite frequently. How can I ensure that every corrected typo doesnāt lead to exorbitant translation costs? Additionally, how can I ensure that new changes are accurately updated in the translations?
I believe this may not be possible, as youād have to modify at vendorās (Microsoft/Google) level. Unless, translated content is subject to the word replacement feature, then you can use that.
Hereās a feature request though:
Autotranslate the first post to English in case itās written in different language.
Have a button to translate the entire thread at once.
Have autotranslate feature enabled for entire forum on user-level. Meaning, if user selects in their profile that they only speak e.g. Romanian, then translate all content to Romanian. If they select they speak multiple languages, posts would be translated only if not in these languages.