Skip to content

Commit

Permalink
Translation services (RocketChat#533)
Browse files Browse the repository at this point in the history
This PR refactors the code of standard Rocket.Chat to allow other providers than google translate to be registered.
Also, it adds a provider for DeepL and for the DB internal translation provider abstraction on the business hub.
  • Loading branch information
vickyokrm authored and mrsimpson committed Sep 26, 2018
1 parent 780d3c2 commit cbb9d09
Show file tree
Hide file tree
Showing 22 changed files with 1,141 additions and 105 deletions.
51 changes: 43 additions & 8 deletions .docker/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -1,20 +1,55 @@
FROM node:8
FROM ubuntu:16.04 as builder

ADD . /app
RUN apt update && apt install curl git bzip2 g++ build-essential python -y

ENV RC_VERSION=0.57.0-designpreview \
DEPLOY_METHOD=docker \
NODE_ENV=production \
PORT=3000 \
ROOT_URL=http://localhost:3000
# meteor installer doesn't work with the default tar binary
RUN apt-get install -y bsdtar \
&& cp $(which tar) $(which tar)~ \
&& ln -sf $(which bsdtar) $(which tar) \
&& curl "https://install.meteor.com/?release=1.6.0.1" \
| sed 's/VERBOSITY="--silent"/VERBOSITY="--progress-bar"/' \
| sh \
&& mv $(which tar)~ $(which tar)

COPY . /app

# Add Chatpal which is a submodule
WORKDIR /app
RUN meteor npm i \
&& meteor npm run postinstall \
&& set +e \
&& meteor add rocketchat:lib --allow-superuser \
&& set -e \
&& meteor build --allow-superuser --server-only --headless --directory /tmp/build

FROM assistify/chat-base:latest

MAINTAINER [email protected]

COPY --from=builder /tmp/build/bundle /app/bundle

RUN set -x \
&& ls -l /app \
&& cd /app/bundle/programs/server \
&& npm install \
&& npm cache clear --force
&& npm cache clear --force \
&& chown -R rocketchat:rocketchat /app

USER rocketchat

VOLUME /app/uploads

WORKDIR /app/bundle

# needs a mongoinstance - defaults to container linking with alias 'mongo'
ENV DEPLOY_METHOD=docker \
NODE_ENV=production \
MONGO_URL=mongodb://mongo:27017/rocketchat \
HOME=/tmp \
PORT=3000 \
ROOT_URL=http://localhost:3000 \
Accounts_AvatarStorePath=/app/uploads

EXPOSE 3000

CMD ["node", "main.js"]
83 changes: 80 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,82 @@
**/bin/**
**/build/*
**/node_modules/*
**/tmp/*
**/.meteor/.id
**/.meteor/dev_bundle
**/.meteor/local*
**/.meteor/meteorite
/private/certs/*
*.bak
*.iml
*.ipr
*.iws
*.launch
*.log
*.pydevproject
*.sublime-project
*.sublime-workspace
*.swp
*.tmp
*.tokens
*.un~
*~
*~.nib
.*.sw[a-z]
.\#*
._*
.buildpath
.classpath
.clover
.cproject
.DS_Store
.elasticbeanstalk
.elc
.emacs.desktop
.emacs.desktop.lock
.env
.externalToolBuilders
.git
.gitignore
LICENSE
README.md
docker-compose.yml
.idea
.vscode
.loadpath
.map
.metadata
packages/rocketchat-livechat/assets/rocketchat-livechat.min.js
.mule
.pmd
.project
.sass-cache
.settings
.Spotlight-V100
tatus
.Trashes
.wtpmodules
\#*\#
Desktop.ini
docker-compose.yml
ehthumbs.db
example.css
jrat.output
jrat.xml
local.properties
meteor-vulcanize
nb-configuration.xml
nbactions.xml
nbproject
profiles.xml
Session.vim
smart.lock
temp_*
Thumbs.db
thumbs.db
tramp
ecosystem.json
pm2.json
settings.json
build.sh
/public/livechat
packages/rocketchat-i18n/i18n/livechat.*
tests/end-to-end/temporary_staged_test
.screenshots
7 changes: 5 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/assistify-dbs-translation/.npm/package/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
7 changes: 7 additions & 0 deletions packages/assistify-dbs-translation/.npm/package/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This directory and the files immediately inside it are automatically generated
when you change this package's NPM dependencies. Commit the files in this
directory (npm-shrinkwrap.json, .gitignore, and this README) to source control
so that others run the same versions of sub-dependencies.

You should NOT check in the node_modules directory that Meteor automatically
creates; if you are using git, the .gitignore file tells git to ignore it.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/rocketchat-autotranslate/.npm/package/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
7 changes: 7 additions & 0 deletions packages/rocketchat-autotranslate/.npm/package/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This directory and the files immediately inside it are automatically generated
when you change this package's NPM dependencies. Commit the files in this
directory (npm-shrinkwrap.json, .gitignore, and this README) to source control
so that others run the same versions of sub-dependencies.

You should NOT check in the node_modules directory that Meteor automatically
creates; if you are using git, the .gitignore file tells git to ignore it.
87 changes: 87 additions & 0 deletions packages/rocketchat-autotranslate/.npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* globals RocketChat */
Meteor.startup(function() {
Tracker.autorun(function() {
if (RocketChat.settings.get('AutoTranslate_Enabled') && RocketChat.authz.hasAtLeastOnePermission(['auto-translate'])) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* globals RocketChat */
import _ from 'underscore';

RocketChat.AutoTranslate = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals ChatSubscription */
/* globals ChatSubscription, RocketChat */
import _ from 'underscore';
import toastr from 'toastr';

Expand Down
Loading

0 comments on commit cbb9d09

Please sign in to comment.