Coder Social home page Coder Social logo

tradumatica / mtradumatica Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 12.67 MB

License: GNU General Public License v3.0

Python 8.56% JavaScript 62.10% CSS 13.52% HTML 3.79% Shell 6.11% Dockerfile 0.08% Makefile 0.52% Scala 4.69% C++ 0.45% Mako 0.03% SCSS 0.16%

mtradumatica's Introduction

MTradumàtica on Python 3 🐍

Fast installation instructions for Ubuntu 16.04 LTS or Ubuntu 18.04 LTS

6-step procedure:

0. Download Mtradumàtica

$ git clone --recurse-submodules https://github.com/tradumatica/mtradumatica

1. Ensure that all prerrequisites are installed

$ sudo MTRADUMATICADIR/scripts/run-as-root.sh

2. Download and install local dependencies

$ MTRADUMATICADIR/scripts/install.sh

3. Start service

$ MTRADUMATICADIR/scripts/startup.sh

5. Browse to "http://localhost:8080"

Docker-based installation (for Linux, Windows or Mac)

You may need to install Docker, you can get it from here https://www.docker.com/community-edition

4-step procedure:

0. Download Mtradumàtica

$ git clone --recurse-submodules https://github.com/tradumatica/mtradumatica

1. Build the Docker image

$ cd mtradumatica
$ docker build -t mtradumatica .

2. Excute the container

$ docker run -p 8080:8080 -p10000:10000 -d --name mtradumatica mtradumatica

3. Browse to "http://localhost:8080"

Multiple user account setup

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.

Add new languages to the interface

When you want to add a new language, follow the next procedure:

1. Add the new language to the LANGUAGES item in config.py

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.

2. Get the .po file for the new language

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.

3. Deploy the translations

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

4. Make the new translation available in the repository

$ git add app/translations/pt/LC_MESSAGES/messages.po
$ git commit -m "New interface language Portuguese"
$ git push

Propagate source code modifications to the translations

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

Remove "fuzzy" marks

When you find a "fuzzy" comment after a hash inside the po files, check it and remove this comment before compiling.

Database migrations

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.

Upgrading with the provided migrations

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.

Generate your own migrations

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

mtradumatica's People

Contributors

gramirez-prompsit avatar mbanon avatar sortiz avatar tradumatica avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.