DesktopTranslator

Local cross-platform machine translation GUI, based on CTranslate2

Download Windows Installer

You can either download a ready-made Windows executable installer for DesktopTranslator, or build an installer yourself.
DesktopTranslator

Translation Models

Currently, DesktopTranslator supports CTranslate2 models, and SentencePiece subwording models (you need both). If you have a model for OpenNMT-py, OpenNMT-tf, or FairSeq, you can convert it to a CTranslate2 format.

If you would like to try out the app and you do not have a model, you can download my French-to-English generic model here.

  1. Unzip the fren.zip archive of the French-to-English generic model you just downloaded. It has two folders, ct2_model for the CTranslate2 model and sp_model for the SentencePiece subwording models of French (source) and English (target).
  2. In DesktopTranslator, click the CTranslate2 Model button, and select the ct2_model folder.
  3. Click the SentencePiece Model button, navigate to the sp_model folder, and select fr.model.
  4. In the left input text-area, type some text in French or use the File menu > Open... to open a *.txt file.
  5. Click the Translate button.

Build Windows Installer

If you want to adjust the code and then build an installer yourself, you can follow these steps:

  1. Install PyInstaller:
pip3 install pyinstaller
  1. To use PyInstaller, specify the Python file name and the argument -w to hide the console window:
pyinstaller -y -w "translator.py"
  1. Try the *.exe file under “dist\translator” to make sure it works. It might complain about the Pmw library. The solution is either remove the Balloon lines, or add this file to the same folder as the translate.py and run the aforementioned PyInstaller command again.
  2. Compress the contents of the “dist” directory created by PyInstaller into a *.zip archive.
  3. Download and install .
  4. Launch NSIS, click Installer based on a .ZIP file, and then click Open to locate the *.zip archive you have just created.
  5. If you want to make the files installed (extracted) to the “Program Files” of the target user, in the Default Folder enter $PROGRAMFILES
  6. If you want to add a shortcut to the internal *.exe file on the Desktop after installation, you can add something like this to the file “Modern.nsh” located at: “C:\Program Files\NSIS\Contrib\zip2exe”. Depending on your OS, the path could be at “Program Files (x86)”. Note that the exe path should be consistent with the path you selected under NSIS’s “Default Folder” drop-down menu, the folder name, and the exe file name.
Section "Desktop Shortcut" SectionX
    SetShellVarContext current
    CreateShortCut "$DESKTOP\DesktopTranslator.lnk" "$PROGRAMFILES\DesktopTranslator\translator.exe"
SectionEnd
  1. Finally, click the NSIS Generate button, which will create the *.exe installer that can be shipped to other Windows machines, without the need to install any extra requirements.
  2. After installation, if you applied step #8, you should find an icon on the Desktop. To uninstall, you can simple remove the app forlder from “Program Files”. For more NSIS options, check this example.

GitHub

View Github