Coder Social home page Coder Social logo

mattermost-plugin-autotranslate's Introduction

Mattermost Autotranslation Plugin (Beta)

Build Status Code Coverage Release HW

Maintainer: @saturninoabril

Autotranslation plugin for Mattermost.

Message autotranslation is powered by Amazon Translate which is a text translation service that uses advanced machine learning technologies to provide high-quality translation on demand. Amazon Translate can translate text between the languages listed in its website.

Feature

  • Translate option available at dropdown menu of each regular post.
  • Slash commands to change user settings using /autotranslate slash command
    • Check user info by issuing /autotranslate info to see current user setting
    • Turn on/off translation by issuing /autotranslate [on|off]
    • Change source language translation by initiating /autotranslate source [language code]
    • Change target language translation by initiating /autotranslate target [language code]
  • Supported Languages and its codes can be found at Amazon Translate website.

Installation

Requires Mattermost 5.22 or higher

  1. Install the plugin
    1. Download the latest version of the plugin from the GitHub releases page
    2. In Mattermost, go to the System Console -> Plugins -> Management
    3. Upload the plugin
  2. Spin up Amazon Translate https://aws.amazon.com/translate/
  3. In Mattermost, go to System Console -> Plugins -> Autotranslate * Fill in the AWS Access Key ID, Secret Access Key and Region
  4. Enable the plugin
    • Go to System Console -> Plugins -> Management and click "Enable" underneath the Autotranslate plugin
  5. Test it out
    • In Mattermost, run the slash command /autotranslate on and see if Translate option becomes available at dropdown menu of a post.

Developing

This plugin contains both a server and web app portion.

Use make dist to build distributions of the plugin that you can upload to a Mattermost server.

Use make check-style to check the style.

Use make localdeploy to deploy the plugin to your local server. You will need to restart the server to get the changes.

mattermost-plugin-autotranslate's People

Contributors

cpanato avatar crspeller avatar daniron26 avatar dependabot-preview[bot] avatar dependabot[bot] avatar hanzei avatar justinegeffen avatar mickmister avatar phoinixgrr avatar saturninoabril avatar spirosoik avatar toninis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mattermost-plugin-autotranslate's Issues

Problem I got when add it to the self-hold mattermost server

I download the plugin source code and compile successfuly, but when I add it to matttermost server, I can't run it successful, I get errors below:

{"level":"error","ts":1539943585.877963,"caller":"app/plugin.go:70","msg":"Unable to activate plugin","plugin_id":"autotranslate","error":"unable to start plugin: autotranslate: Must have AWS Access Key ID","errorVerbose":"Must have AWS Access Key ID\nunable to start plugin: autotranslate\ngithub.com/mattermost/mattermost-server/plugin.(*Environment).Activate\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/plugin/environment.go:211\ngithub.com/mattermost/mattermost-server/app.(*App).SyncPluginsActiveState\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/plugin.go:68\ngithub.com/mattermost/mattermost-server/app.(*App).InitPlugins.func2\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/plugin.go:141\ngithub.com/mattermost/mattermost-server/app.(*App).InvokeConfigListeners\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/config.go:138\ngithub.com/mattermost/mattermost-server/app.(*App).UpdateConfig\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/config.go:50\ngithub.com/mattermost/mattermost-server/app.(*App).EnablePlugin\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/plugin.go:206\ngithub.com/mattermost/mattermost-server/api4.enablePlugin\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/api4/plugin.go:183\ngithub.com/mattermost/mattermost-server/web.Handler.ServeHTTP\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/web/handlers.go:131\ngithub.com/mattermost/mattermost-server/web.(*Handler).ServeHTTP\n\t:1\ngithub.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux.(*Router).ServeHTTP\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux/mux.go:162\ngithub.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers.recoveryHandler.ServeHTTP\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers/recovery.go:78\ngithub.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers.(*recoveryHandler).ServeHTTP\n\t:1\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2741\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1847\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1333"}
{"level":"error","ts":1539943588.0861664,"caller":"app/plugin_requests.go:33","msg":"Access to route for non-existent plugin","missing_plugin_id":"autotranslate","error":"plugin not found: autotranslate"}

image

mattermost verison 5.4.0

I add ak and sk of aws correctly, but it also got the error "Must have AWS Access Key ID", Can somebody help me?

AWS Translate code not working: zh-TW, fa-AF, fr-CA, es-MX

For the language codes that has a hyphen in between, /autotranslate target [code] will respond with no error, but an attempt to translate will result in an error: Invalid parameter: target (close)

these languages are essentially not working

Unable to start plugin: autotranslate: Must have AWS Access Key ID

Hello again,

I am very sorry to write twice in such a short period of time. I did my best to troubleshoot the issue, but I cannot wrap my head around this. The error message doesn't describe the issue, and I don't know if you can replicate it. If it's too much work to investigate, no problem :)

When I install and start the 0.2.0 plugin, I get the following error in the logs (see full log at the bottom):

unable to start plugin: autotranslate: Must have AWS Access Key ID

I did the following steps to troubleshoot:

  1. Deleted the plugin in the system console
  2. Stopped mattermost
  3. Deleted the settings in config.json related to the plugin
  4. Started Mattermost
  5. Installed the plugin in system console
  6. Put the AWS Keys in the plugin settings
  7. Attempted to start the plugin

Things I looked at:

  • I checked the config.json file, there is no issue with it. The AWS values are saved correctly.
  • I tried on a test server (same DB and server specs, but no other plugins and different config.json), same issue.
  • I looked at the code. Here is the part that seems to check for the AWS key in server/plugin.go:
func (p *Plugin) IsValid() error {
	if p.AWSAccessKeyID == "" {
		return fmt.Errorf("Must have AWS Access Key ID")
	}

	if p.AWSSecretAccessKey == "" {
		return fmt.Errorf("Must have AWS Secret Access Key")
	}

	if p.AWSRegion == "" {
		return fmt.Errorf("AWS Region")
	}

	return nil
}

And here is the definition in the plugin.json file:

"settings": [
            {
                "key": "AWSAccessKeyID",
                "display_name": "AWS Access Key ID",
                "type": "text",
                "help_text": "The access key ID from AWS"
            },

In the config.json file, the keys are not capitalized:

"autotranslate": {
                "awsaccesskeyid": "XXXXXXXXXX",
                "awsregion": "eu-central-1",
                "awssecretaccesskey": "XXXXXXXXXXXXXXXXXXXXXXXXX"
            }

Could this be it? If it is and you don't have the time, I can try making a pull request where I rename all the keys to be lower case in the repo.

I'm running MM 5.12 on a Linode server running Debian Stretch.

If you need me to do anything to help, please ask!

PS: This is the full error log:

2019-06-25T14:37:31.437+0200 debug web/handlers.go:58 POST - /api/v4/plugins/autotranslate/enable
2019-06-25T14:37:31.462+0200 debug jobs/workers.go:108 Workers received config change.
2019-06-25T14:37:31.478+0200 debug jobs/schedulers.go:185 Schedulers received config change.
2019-06-25T14:37:31.490+0200 debug jobs/schedulers.go:167 Next run time for scheduler MigrationsScheduler: <nil>
2019-06-25T14:37:31.514+0200 debug plugin/hclog_adapter.go:33 starting plugin {"plugin_id": "autotranslate", "wrapped_extras": "pathplugins/autotranslate/server/dist/plugin-linux-amd64args[plugins/autotranslate/server/dist/plugin-linux-amd64]"}
2019-06-25T14:37:31.515+0200 debug plugin/hclog_adapter.go:33 plugin started {"plugin_id": "autotranslate", "wrapped_extras": "pathplugins/autotranslate/server/dist/plugin-linux-amd64pid19793"}
2019-06-25T14:37:31.515+0200 debug plugin/hclog_adapter.go:33 waiting for RPC address {"plugin_id": "autotranslate", "wrapped_extras": "pathplugins/autotranslate/server/dist/plugin-linux-amd64"}
2019-06-25T14:37:31.569+0200 debug plugin/hclog_adapter.go:33 plugin address {"plugin_id": "autotranslate", "wrapped_extras": "address/tmp/plugin808676694networkunixtimestamp2019-06-25T14:37:31.569+0200"}
2019-06-25T14:37:31.570+0200 debug plugin/hclog_adapter.go:33 using plugin {"plugin_id": "autotranslate", "wrapped_extras": "version1"}
2019-06-25T14:37:31.609+0200 debug plugin/hclog_adapter.go:33 plugin process exited {"plugin_id": "autotranslate", "wrapped_extras": "pathplugins/autotranslate/server/dist/plugin-linux-amd64pid19793"}
2019-06-25T14:37:31.610+0200 debug plugin/hclog_adapter.go:35 plugin exited {"plugin_id": "autotranslate"}
2019-06-25T14:37:31.610+0200 error mlog/log.go:172 Unable to activate plugin {"plugin_id": "autotranslate", "error": "unable to start plugin: autotranslate: Must have AWS Access Key ID", "errorVerbose": "Must have AWS Access Key ID
unable to start plugin: autotranslate
github.com/mattermost/mattermost-server/plugin.(*Environment).Activate
\t/go/src/github.com/mattermost/mattermost-server/plugin/environment.go:230
github.com/mattermost/mattermost-server/app.(*App).SyncPluginsActiveState
\t/go/src/github.com/mattermost/mattermost-server/app/plugin.go:95
github.com/mattermost/mattermost-server/app.(*App).InitPlugins.func2
\t/go/src/github.com/mattermost/mattermost-server/app/plugin.go:172
github.com/mattermost/mattermost-server/config.(*emitter).invokeConfigListeners.func1
\t/go/src/github.com/mattermost/mattermost-server/config/emitter.go:35
sync.(*Map).Range
\t/usr/local/go/src/sync/map.go:333
github.com/mattermost/mattermost-server/config.(*emitter).invokeConfigListeners
\t/go/src/github.com/mattermost/mattermost-server/config/emitter.go:33
github.com/mattermost/mattermost-server/config.(*commonStore).set
\t/go/src/github.com/mattermost/mattermost-server/config/common.go:82
github.com/mattermost/mattermost-server/config.(*FileStore).Set
\t/go/src/github.com/mattermost/mattermost-server/config/file.go:97
github.com/mattermost/mattermost-server/app.(*Server).UpdateConfig
\t/go/src/github.com/mattermost/mattermost-server/app/config.go:53
github.com/mattermost/mattermost-server/app.(*App).UpdateConfig
\t/go/src/github.com/mattermost/mattermost-server/app/config.go:59
github.com/mattermost/mattermost-server/app.(*App).EnablePlugin
\t/go/src/github.com/mattermost/mattermost-server/app/plugin.go:245
github.com/mattermost/mattermost-server/api4.enablePlugin
\t/go/src/github.com/mattermost/mattermost-server/api4/plugin.go:191
github.com/mattermost/mattermost-server/web.Handler.ServeHTTP
\t/go/src/github.com/mattermost/mattermost-server/web/handlers.go:144
github.com/mattermost/mattermost-server/vendor/github.com/NYTimes/gziphandler.GzipHandlerWithOpts.func1.1
\t/go/src/github.com/mattermost/mattermost-server/vendor/github.com/NYTimes/gziphandler/gzip.go:336
net/http.HandlerFunc.ServeHTTP
\t/usr/local/go/src/net/http/server.go:1995
github.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux.(*Router).ServeHTTP
\t/go/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux/mux.go:212
net/http.serverHandler.ServeHTTP
\t/usr/local/go/src/net/http/server.go:2774
net/http.(*conn).serve
\t/usr/local/go/src/net/http/server.go:1878
runtime.goexit
\t/usr/local/go/src/runtime/asm_amd64.s:1337"}

Feature request: Translate Channel

Thank you for developing this plugin. This is the main reason mattermost is useful for me and my international team.

Being opensource and based on AWS is important for privacy and security issues, in that area slack+untangle (its auto translation bot) cannot match. However the slack combo has an important feature that is lacking in the mattermost counterpart, that is to translate an entire channel, so that the user do not need to click the "translate" button for every message.

We are in the creative industries and being able to exchange ideas seamlessly and freely is important, the conversation needs to have a flow, the translate button can break this flow. This is the only reason we cannot adopt mattermost right now.

Please consider adding the feature to translate every new message for the entire channel without further user input.

Cheers
DS

Unable to install latest version

I keep receiving this error with v0.2.0, both when I download the published release or build from source:


{"level":"error","ts":1565852540.218115,"caller":"mlog/log.go:172","msg":"Unable to activate plugin","plugin_id":"autotranslate","error":"unable to start plugin: autotranslate: Unrecognized remote plugin message: \n\nThis usually means that the plugin is either invalid or simply\nneeds to be recompiled to support the latest protocol.","errorVerbose":"Unrecognized remote plugin message: \n\nThis usually means that the plugin is either invalid or simply\nneeds to be recompiled to support the latest protocol.\nunable to start plugin: autotranslate\ngithub.com/mattermost/mattermost-server/plugin.(*Environment).Activate\n\t/go/src/github.com/mattermost/mattermost-server/plugin/environment.go:230\ngithub.com/mattermost/mattermost-server/app.(*App).SyncPluginsActiveState\n\t/go/src/github.com/mattermost/mattermost-server/app/plugin.go:95\ngithub.com/mattermost/mattermost-server/app.(*App).InitPlugins\n\t/go/src/github.com/mattermost/mattermost-server/app/plugin.go:126\ngithub.com/mattermost/mattermost-server/app.(*Server).RunOldAppInitalization.func6\n\t/go/src/github.com/mattermost/mattermost-server/app/server_app_adapters.go:147\ngithub.com/mattermost/mattermost-server/config.(*emitter).invokeConfigListeners.func1\n\t/go/src/github.com/mattermost/mattermost-server/config/emitter.go:35\nsync.(*Map).Range\n\t/usr/local/go/src/sync/map.go:333\ngithub.com/mattermost/mattermost-server/config.(*emitter).invokeConfigListeners\n\t/go/src/github.com/mattermost/mattermost-server/config/emitter.go:33\ngithub.com/mattermost/mattermost-server/config.(*commonStore).set\n\t/go/src/github.com/mattermost/mattermost-server/config/common.go:82\ngithub.com/mattermost/mattermost-server/config.(*FileStore).Set\n\t/go/src/github.com/mattermost/mattermost-server/config/file.go:97\ngithub.com/mattermost/mattermost-server/app.(*Server).UpdateConfig\n\t/go/src/github.com/mattermost/mattermost-server/app/config.go:53\ngithub.com/mattermost/mattermost-server/app.(*App).UpdateConfig\n\t/go/src/github.com/mattermost/mattermost-server/app/config.go:59\ngithub.com/mattermost/mattermost-server/app.(*App).EnablePlugin\n\t/go/src/github.com/mattermost/mattermost-server/app/plugin.go:245\ngithub.com/mattermost/mattermost-server/api4.enablePlugin\n\t/go/src/github.com/mattermost/mattermost-server/api4/plugin.go:191\ngithub.com/mattermost/mattermost-server/web.Handler.ServeHTTP\n\t/go/src/github.com/mattermost/mattermost-server/web/handlers.go:144\ngithub.com/mattermost/mattermost-server/vendor/github.com/NYTimes/gziphandler.GzipHandlerWithOpts.func1.1\n\t/go/src/github.com/mattermost/mattermost-server/vendor/github.com/NYTimes/gziphandler/gzip.go:336\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:1995\ngithub.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux.(*Router).ServeHTTP\n\t/go/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux/mux.go:212\ngithub.com/mattermost/mattermost-server/app.(*RateLimiter).RateLimitHandler.func1\n\t/go/src/github.com/mattermost/mattermost-server/app/ratelimit.go:109\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:1995\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2774\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1878\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1337"}

White page with Mattermost 5.12

Hello,

Thank you for developing the plugin. After updating Mattermost to version 5.12 (from 5.10), I have noticed that the Autotranslate plugin has an issue, that turns the whole page white.
I know you have published new commits recently, but I cannot read code to know if this fixes this issue. Please ignore this if it has already been fixed and only needs to be released.
Mattermost 5.11 and 5.12 introduced the following changes for plugins (from https://docs.mattermost.com/administration/changelog.html#release-v5-12-feature-release):

  • If your plugin uses the DeleteEphemeralMessage plugin API, update it to accept a postId string parameter.

Again, thank you for this great plugin.

If I can help in any way about the issue, please ask.

Jonas

Translate multiple selected languages

Hey there, thanks so much for creating such a useful plugin for mattermost. Greatly appreciate it. Has helped my global team in communications.

I would like to ask that instead of relying on AWS Comprehend for the 'auto' function of the plugin (as they do not provide us a free tier),

Is there a way to select multiple source languages manually? Currently, I believe that the following command only supports 1 language source

/autotranslate source zh

and does not support multiple source languages.

Translation does not occur

Even though I have provided all API settings and Amazon-side permissions correctly, the translation does not work. I wonder what I might have missed in this regard?

Screenshot from 2023-11-01 21-04-31

plugin does not work

When I clicked on the drop down menu, it did not work, nothing happened

image

Plugin version: 0.2.0. Revision number: 8c87f7f
Mattermost Version: 5.16.2

docs(readme): Currently not compatible with Mattermost?

From the README:

Installation

Requires Mattermost 5.4 or higher (Currently not compatible with Mattermost as there's minor change requested to plugin system.)

I'm specifically curious about this line:

Currently not compatible with Mattermost as there's minor change requested to plugin system.

Is this accurate?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.