- A python program that allows you to translate multiple images via google translator, without wasting time in clicking & dragging; based on selenium.
- Still under development, please report bugs.
- For now, it only works on Debian; but it may work for other ditributions if you know how to install dependencies.
- Python libraries: pyperclip & selenium.
- Linux packages: xclip, xsel & wl-clipboard.
- Google Chrome or Chromium.
- There is an installer for the requirements (for Debian), but you can install them manually (better to install python libraries in a venv) & skip step (1).
- Open the terminal in the program's directory and:
- type:
python install_requirements.py
(or python3), and wait. - A 'venv' folder should appear, now before executing the program, activate the venv:
source venv/bin/activate
- Download & install google chrome: https://www.google.com/chrome/ (flatpak repository may cause issues!); or Chromium.
-For brief instructions, type in the terminal: python google_translate.py -h
- This is the simplest command:
python google_translate.py -i images -l en_ar <br>
- The argument '-i images' is the folder containing the images, it must be inside the program folder, otherwise use absolute path.
- The argument '-l en_ar' means translating from english (en) to arabic (ar), separated with an underscore.
- To find your language's shortcut, see the 'languages_list.txt' file.
- When this command is executed, google chrome will show up & start translating on its own (it's not a virus o_o).
python google_translate.py -i images -l en_ar -o output.txt -q 60 -k true
- The argument '-o output.txt' is where your translated text will be saved, here it will be saved inside the program folder, otherwise use absolute path.
- The argument '-q 60' means: when the translation finishes, how much time to wait before closing the browser & exiting the program (in seconds).
- The argument '-k true' is an HTTP connection parameter; when true, the client binding keeps the same connection for every request, which may speed up the process.
- To deactivate the venv, simply type:
deactivate
- To remove the venv, simply delete the folder.
- A selenium folder may be left in the ~/.cache directory, delete it.
- Errors handling.
- No need to specify the '-c' argument anymore (c: time between upload & copy).