- Install python 3.6 on an environment with a bash terminal (e.g., linux, macos, or windows with cygwin or git bash installed)
- (python 3.5 or python 3.7 should be ok if that is what you have installed currently)
- clone the repo 'website_scripts' - https://github.com/CityOfDetroit/website_scripts
- set up your environment dependencies in website_scripts:
- in bash, navigate to wherever you cloned website_scripts (e.g., /home/kaebnickk/sites/website_scripts/) and run the following:
- create a virtualenv in website_scripts:
python3 -m venv .
- activate the virtualenv you just created:
source bin/activate
(orsource scripts/activate
if you are in windows) - now install your dependencies:
pip install -r requirements.txt
- create a file named
google_translate_key.json
in the root of the repo (get the data to put in this file from edgar or karl - it contains keys and credentials and stuff that cannot go in the repo) - put your english content to be translated into a text file in the root of the repo - e.g., "content.txt"
- note that this should be your actual html code
- now you should be able to run the translator, like this:
./machine_translator.py content.txt
- this will generate 3 output files, with filenames where the language abbreviation is in front of the original input filename - i.e., if your file of english content to be translated was named "content.txt", then the output files will be "ar_content.txt", "bn_content.txt" and "es_content.txt" - you can now manually upload these into your translations
Last active
July 19, 2019 21:58
-
-
Save karlkaebnick/028965a208cfa76bf62906aed8b5efe9 to your computer and use it in GitHub Desktop.
How to run the machine translation script
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment