Ember deprecation warning for Translator plugin

I’m seeing an Ember deprecation warning for this plugin…

`
DEPRECATION: [PLUGIN discourse-translator-085393fc180a351d3e74518ec7971e580d749bf93686b725cf4995ffeeb614ba] Usage of the Ember Global is deprecated. You should import the Ember module or the specific API instead. [deprecation id: ember-global] See Ember.js - Deprecations for more details.
(anonymous) @ deprecate-shim.js:33

I appear to have the latest version (1.0.0) of the plugin so I assume an update will be available before Ember5 Day.

3 Likes

Thanks for the report @packman. The latest version of this plugin shouldn’t be triggering that warning. Also I wouldn’t normally expect the name of the plugin to include this string of random characters at the end:

I would expect just [PLUGIN discourse-translator] :thinking:

Is there a chance you’re using a forked version of the plugin? Could you link to the forum so we can take a look?

1 Like

My apologies…I do have a forked version in use. It’s the one from GitHub - LibreTranslate/discourse-translator: Discourse translator with LibreTranslate support.

I need to try to remember why I used that version.

2 Likes

I remember why. The official translator plugin doesn’t support LibreTranslate :frowning:

2 Likes

If anyone is a member of the support forum for the LibreTranslate forked plugin could you please add a post about this deprecation warning. The forked Github doesn’t appear to allow issues to be raised against it and I’ve tried to register on the forum to report this myself but the account creation confirmation email isn’t arriving.

2 Likes

It looks like we have a (very old, sorry! :sweat:) PR on the official repository to add LibreTranslate support. We’ll try and get that merged ASAP, and then people can move onto the official copy of the plugin with Ember 5 support

5 Likes

This is now merged, sorry again for the very long delay. From a quick test, LibreTranslate seems like a great open-source alternative to paid services.

(Will update the OP instructions as well.)

7 Likes

It is :grinning: It’s just another Docker app, although it’s not very lightweight.

2 Likes

I’ve installed the new official plugin instead of the forked version but I’m not getting any translations. I’ve checked older posts that I’m pretty sure had been previously translated and also entered new topics with French text (default language is English), but the old translations no longer exist and the new posts aren’t translated.

I’ve set LibreTranslate as translator, set the path to my internal instance, no API key (internal instance), max translations per minute is the default (3). I’ve set the two ‘restrict’ settings to ‘everyone’ to allow everyone to translate and everyone’s posts to be translated. The wording of those settings is a little confusing (restrict versus allowlists) so I’m not sure that’s definitely correct, but I’ve also tried with both fields blank and still don’t see any translations. The plugin is enabled for inline translation.

I’ve tested my LibreTranslate instance through its own web interface and it’s happily translating non-English text I’ve entered.

I can’t see any errors logged relating to the translator since installing the official plugin and the Javascript console doesn’t show any errors either.

I’m not sure what to look at next to try to debug this.

1 Like

Are there any revelant errors in /logs?

2 Likes

No. The only discourse-translator item is a deprecation warning:

Deprecation notice: SiteSetting.min_trust_to_flag_posts has been deprecated. Please use SiteSetting.flag_post_allowed_groups instead. (removal in Discourse 3.3)
At /var/www/discourse/lib/site_setting_extension.rb:202:in public_send

That’s for a HTTP Referrer of

https://discourse.weather-watch.com/admin/site_settings/category/all_results?filter=plugin%3Adiscourse-translator

so I’m not 100% sure that’s actually the plugin or the system plugin interface.

1 Like

I just tried another message with default ‘restrict’ settings and got

### Message (2 copies reported)

Job exception: uninitialized constant DiscourseTranslator::LibreTranslate

### Backtrace

activesupport-7.0.7/lib/active_support/inflector/methods.rb:278:in `const_get'

activesupport-7.0.7/lib/active_support/inflector/methods.rb:278:in `constantize'

activesupport-7.0.7/lib/active_support/core_ext/string/inflections.rb:74:in `constantize'

/var/www/discourse/plugins/discourse-translator/plugin.rb:125: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:124:in `execute'

/var/www/discourse/app/jobs/base.rb:292:in `block (2 levels) in perform'

rails_multisite-5.0.0/lib/rails_multisite/connection_management.rb:82:in `with_connection'

/var/www/discourse/app/jobs/base.rb:279:in `block in perform'

/var/www/discourse/app/jobs/base.rb:275:in `each'

/var/www/discourse/app/jobs/base.rb:275:in `perform'

sidekiq-6.5.12/lib/sidekiq/processor.rb:202:in `execute_job'

sidekiq-6.5.12/lib/sidekiq/processor.rb:170:in `block (2 levels) in process'

sidekiq-6.5.12/lib/sidekiq/middleware/chain.rb:177:in `block in invoke'

/var/www/discourse/lib/sidekiq/pausable.rb:132:in `call'

sidekiq-6.5.12/lib/sidekiq/middleware/chain.rb:179:in `block in invoke'

sidekiq-6.5.12/lib/sidekiq/middleware/chain.rb:182:in `invoke'

sidekiq-6.5.12/lib/sidekiq/processor.rb:169:in `block in process'

sidekiq-6.5.12/lib/sidekiq/processor.rb:136:in `block (6 levels) in dispatch'

sidekiq-6.5.12/lib/sidekiq/job_retry.rb:113:in `local'

sidekiq-6.5.12/lib/sidekiq/processor.rb:135:in `block (5 levels) in dispatch'

sidekiq-6.5.12/lib/sidekiq.rb:44:in `block in <module:Sidekiq>'

sidekiq-6.5.12/lib/sidekiq/processor.rb:131:in `block (4 levels) in dispatch'

sidekiq-6.5.12/lib/sidekiq/processor.rb:263:in `stats'

sidekiq-6.5.12/lib/sidekiq/processor.rb:126:in `block (3 levels) in dispatch'

sidekiq-6.5.12/lib/sidekiq/job_logger.rb:13:in `call'

sidekiq-6.5.12/lib/sidekiq/processor.rb:125:in `block (2 levels) in dispatch'

sidekiq-6.5.12/lib/sidekiq/job_retry.rb:80:in `global'

sidekiq-6.5.12/lib/sidekiq/processor.rb:124:in `block in dispatch'

sidekiq-6.5.12/lib/sidekiq/job_logger.rb:39:in `prepare'

sidekiq-6.5.12/lib/sidekiq/processor.rb:123:in `dispatch'

sidekiq-6.5.12/lib/sidekiq/processor.rb:168:in `process'

sidekiq-6.5.12/lib/sidekiq/processor.rb:78:in `process_one'

sidekiq-6.5.12/lib/sidekiq/processor.rb:68:in `run'

sidekiq-6.5.12/lib/sidekiq/component.rb:8:in `watchdog'

sidekiq-6.5.12/lib/sidekiq/component.rb:17:in `block in safe_thread'

### Env

1/2

hostname hv1-app
process_id 11330
application_version 0513865c3cbbf8449bcfdc0dff3d9c382d2c4207
current_db default
current_hostname discourse.weather-watch.com
job Jobs::DetectTranslation
problem_db default
time 10:03 pm
opts post_id 574164
--- --- --- ---
--- ---
current_site_id default
2 Likes

Yes, I know what this is, I am working on a fix.

3 Likes

Logs are coming thick and fast now…not sure why they’re appearing now when they didn’t earlier. It’s getting late here (UK) so this will probably be my last post for the night. I’ll be back tomorrow if you need more info.

Message (3 copies reported)
NameError (uninitialized constant DiscourseTranslator::LibreTranslate)
(eval):111:in `_fast_attributes'
app/serializers/post_stream_serializer_mixin.rb:54:in `block in posts'
app/serializers/post_stream_serializer_mixin.rb:47:in `map'
app/serializers/post_stream_serializer_mixin.rb:47:in `posts'
app/serializers/post_stream_serializer_mixin.rb:18:in `post_stream'
(eval):3:in `_fast_attributes'
app/controllers/topics_controller.rb:1335:in `block (2 levels) in perform_show_response'
app/controllers/topics_controller.rb:1329:in `perform_show_response'
app/controllers/topics_controller.rb:187:in `show'
app/controllers/application_controller.rb:422:in `block in with_resolved_locale'
app/controllers/application_controller.rb:422:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:64:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:393:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/008-rack-cors.rb:14:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:233:in `call'
Backtrace
activesupport (7.0.7) lib/active_support/inflector/methods.rb:278:in `const_get'
activesupport (7.0.7) lib/active_support/inflector/methods.rb:278:in `constantize'
activesupport (7.0.7) lib/active_support/core_ext/string/inflections.rb:74:in `constantize'
plugins/discourse-translator/plugin.rb:167:in `can_translate'
(eval):111:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:347:in `as_json'
app/serializers/post_stream_serializer_mixin.rb:54:in `block in posts'
activerecord (7.0.7) lib/active_record/relation/delegation.rb:88:in `each'
activerecord (7.0.7) lib/active_record/relation/delegation.rb:88:in `each'
app/serializers/post_stream_serializer_mixin.rb:47:in `map'
app/serializers/post_stream_serializer_mixin.rb:47:in `posts'
plugins/discourse-reactions/lib/discourse_reactions/topic_view_serializer_extension.rb:15:in `posts'
app/serializers/post_stream_serializer_mixin.rb:18:in `post_stream'
(eval):3:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:347:in `as_json'
activesupport (7.0.7) lib/active_support/json/encoding.rb:22:in `encode'
activesupport (7.0.7) lib/active_support/json/encoding.rb:22:in `encode'
activesupport (7.0.7) lib/active_support/core_ext/object/json.rb:42:in `to_json'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:331:in `to_json'
multi_json (1.15.0) lib/multi_json/adapters/oj.rb:56:in `dump'
multi_json (1.15.0) lib/multi_json/adapters/oj.rb:56:in `dump'
multi_json (1.15.0) lib/multi_json/adapter.rb:25:in `dump'
multi_json (1.15.0) lib/multi_json.rb:139:in `dump'
app/controllers/topics_controller.rb:1335:in `block (2 levels) in perform_show_response'
actionpack (7.0.7) lib/action_controller/metal/mime_responds.rb:214:in `respond_to'
app/controllers/topics_controller.rb:1329:in `perform_show_response'
app/controllers/topics_controller.rb:187:in `show'
actionpack (7.0.7) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.7) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.7) lib/action_controller/metal/rendering.rb:165:in `process_action'
actionpack (7.0.7) lib/abstract_controller/callbacks.rb:234:in `block in process_action'
activesupport (7.0.7) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
app/controllers/application_controller.rb:422:in `block in with_resolved_locale'
i18n (1.14.1) lib/i18n.rb:322:in `with_locale'
app/controllers/application_controller.rb:422:in `with_resolved_locale'
activesupport (7.0.7) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.7) lib/active_support/callbacks.rb:138:in `run_callbacks'
actionpack (7.0.7) lib/abstract_controller/callbacks.rb:233:in `process_action'
actionpack (7.0.7) lib/action_controller/metal/rescue.rb:23:in `process_action'
actionpack (7.0.7) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
activesupport (7.0.7) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.7) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (7.0.7) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.0.7) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
actionpack (7.0.7) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (7.0.7) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (7.0.7) lib/abstract_controller/base.rb:151:in `process'
actionview (7.0.7) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (3.3.0) lib/mini_profiler/profiling_methods.rb:89:in `block in profile_method' 
actionpack (7.0.7) lib/action_controller/metal.rb:188:in `dispatch'
actionpack (7.0.7) lib/action_controller/metal.rb:251:in `dispatch'
actionpack (7.0.7) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.0.7) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.0.7) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.7) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.7) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.7) lib/action_dispatch/routing/route_set.rb:852:in `call'
lib/middleware/omniauth_bypass_middleware.rb:64:in `call'
rack (2.2.8) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.8) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.8) lib/rack/head.rb:12:in `call'
actionpack (7.0.7) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:393:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/008-rack-cors.rb:14:in `call'
rack (2.2.8) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.8) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (7.0.7) lib/action_dispatch/middleware/cookies.rb:704:in `call'
actionpack (7.0.7) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.7) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.7) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.7) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
actionpack (7.0.7) lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
logster (2.13.1) lib/logster/middleware/reporter.rb:40:in `call'
railties (7.0.7) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.7) lib/rails/rack/logger.rb:27:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
actionpack (7.0.7) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
actionpack (7.0.7) lib/action_dispatch/middleware/request_id.rb:26:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
rack (2.2.8) lib/rack/method_override.rb:24:in `call'
actionpack (7.0.7) lib/action_dispatch/middleware/executor.rb:14:in `call'
rack (2.2.8) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.7) lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
rack-mini-profiler (3.3.0) lib/mini_profiler.rb:191:in `call'
message_bus (4.3.8) lib/message_bus/rack/middleware.rb:60:in `call'
lib/middleware/request_tracker.rb:233:in `call'
railties (7.0.7) lib/rails/engine.rb:530:in `call'
railties (7.0.7) lib/rails/railtie.rb:226:in `public_send'
railties (7.0.7) lib/rails/railtie.rb:226:in `method_missing'
rack (2.2.8) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.8) lib/rack/urlmap.rb:58:in `each'
rack (2.2.8) lib/rack/urlmap.rb:58:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn (6.1.0) lib/unicorn/http_server.rb:143:in `start'
unicorn (6.1.0) bin/unicorn:128:in `<top (required)>'
vendor/bundle/ruby/3.2.0/bin/unicorn:25:in `load'
vendor/bundle/ruby/3.2.0/bin/unicorn:25:in `<main>'
Env
  1/3  
hostname	hv1-app
process_id	11359
application_version	0513865c3cbbf8449bcfdc0dff3d9c382d2c4207
HTTP_HOST	discourse.weather-watch.com
REQUEST_URI	/t/vp2-low-battery-warning/41154
REQUEST_METHOD	GET
HTTP_USER_AGENT	Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0
HTTP_ACCEPT	text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
HTTP_REFERER	https://discourse.weather-watch.com/search?q=low%20batt
HTTP_X_FORWARDED_FOR	255.36.47.44, 10.20.0.1
HTTP_X_REAL_IP	10.20.0.1
username	luciano_giannobile
time	10:08 pm
2 Likes

FIX: Broken LibreTranslate support by pmusaraj · Pull Request #128 · discourse/discourse-translator · GitHub should fix the issue @packman, sorry about this, I made a terrible copy/paste mistake when trying to fix linting for the PR :man_facepalming:. That commit is now merged though, so if you rebuild, hopefully it will just work.

6 Likes