6-step procedure:
$ git clone --recurse-submodules https://github.com/tradumatica/mtradumatica
$ sudo MTRADUMATICADIR/scripts/run-as-root.sh
$ MTRADUMATICADIR/scripts/install.sh
$ MTRADUMATICADIR/scripts/startup.sh
5. Browse to "http://localhost:8080"
You may need to install Docker, you can get it from here https://www.docker.com/community-edition
4-step procedure:
$ git clone --recurse-submodules https://github.com/tradumatica/mtradumatica
$ cd mtradumatica
$ docker build -t mtradumatica .
$ docker run -p 8080:8080 -p10000:10000 -d --name mtradumatica mtradumatica
3. Browse to "http://localhost:8080"
Both installation procedures can provide multiple user accounts inside Mtradumatica based on the Google identity server through the OAUTH2 protocol. The procedure of setting such a server in the Google side is a bit complex and Google changes it from time to time, but it can be found here. Although not official, a useful resource is this video.
In order to get the user data once they are signed in, an API endpoint is used. This endpoint
may change due to changes in the API. If you ever need to modify it, edit the GOOGLE_USER_DATA_URL
in config.py.
From the process above, you will get at the end two strings, "client ID" and "client secret". You can edit the config.py file in the following way (alternatively, you can create a instance/config.py file with the following content):
SECRET_KEY = 'put a random string here'
DEBUG = False
ADMINS = ['[email protected]', '[email protected]']
USER_LOGIN_ENABLED = True
OAUTHLIB_INSECURE_TRANSPORT = True # True also behind firewall, False -> require HTTPS
GOOGLE_OAUTH_CLIENT_ID = 'xxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com'
GOOGLE_OAUTH_CLIENT_SECRET = 'xxxxxxxxxxxxxxx'
GOOGLE_USER_DATA_URL = '/oauth2/v1/userinfo'
The admin accounts in ADMINS will allow you to use admin features as translator optimization or the remote Moses server. You can set as many as you want.
When you want to add a new language, follow the next procedure:
You need a language code and the name of the language. The language code is normally an ISO-639-1 code and the name should be the native language name for each code. For example, if we want to add Portuguese we will change this
LANGUAGES = { 'ca': u'Català', 'en': u'English', 'es': u'Spanish' }
for this
LANGUAGES = { 'ca': u'Català', 'en': u'English', 'es': u'Spanish', 'pt': u'Português'}
Note the small u BEFORE and STICKED to the quotation marks after the colons. Uncoment the line if necessary.
For the case of Portuguese, proceed in this way
$ source venv/bin/activate
(venv) $ cd app
(venv) $ pybabel extract -F babel.cfg -o messages.pot .
(venv) $ pybabel init -i messages.pot -d translations -l pt
Then you will find the file at app/translations/pt/LC_MESSAGES/messages.po
to translate it using your preferred tool or editor.
Just restore the messages.po
file to the very same path you found it and
execute:
$ source venv/bin/activate
(venv) $ cd app
(venv) $ pybabel compile -d translations
Then you can restart the system and look at the new translations
$ git add app/translations/pt/LC_MESSAGES/messages.po
$ git commit -m "New interface language Portuguese"
$ git push
Execute
$ source venv/bin/activate
(venv) $ cd app
(venv) $ pybabel extract -F babel.cfg -o messages.pot .
(venv) $ pybabel update -i messages.pot -d translations
(venv) $ pybabel compile -d translations
Then edit all .po files to translate the new strings
When you find a "fuzzy" comment after a hash inside the po files, check it and remove this comment before compiling.
This project uses Flask-Migrate to manage database changes. A migration contains the changes from the previous version of the database to the next one. The process of applying a migration is known as upgrade.
In the root directory of this project, run:
flask db upgrade
This will run migrations that include changes which have not been already applied to the database.
⚠ Please note that this project runs SQLite as the database engine. Dropping columns in SQLite is not supported, so be sure that you really want to upgrade to a version with new columns.
If you change the database, you can generate a migration by running:
flask db migrate -m "[DESCRIPTION]"
Don't forget to apply the migration by running flask db upgrade