{"id":13689805,"url":"https://github.com/ymoslem/DesktopTranslator","last_synced_at":"2025-05-02T06:31:23.226Z","repository":{"id":43829966,"uuid":"443538808","full_name":"ymoslem/DesktopTranslator","owner":"ymoslem","description":"Local cross-platform machine translation GUI, based on CTranslate2","archived":false,"fork":false,"pushed_at":"2024-01-09T09:36:50.000Z","size":1808,"stargazers_count":91,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-11T14:44:25.394Z","etag":null,"topics":["gui-application","neural-machine-translation","opennmt"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ymoslem.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-01-01T12:55:47.000Z","updated_at":"2025-03-13T02:05:47.000Z","dependencies_parsed_at":"2024-01-14T17:16:34.294Z","dependency_job_id":null,"html_url":"https://github.com/ymoslem/DesktopTranslator","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymoslem%2FDesktopTranslator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymoslem%2FDesktopTranslator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymoslem%2FDesktopTranslator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymoslem%2FDesktopTranslator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ymoslem","download_url":"https://codeload.github.com/ymoslem/DesktopTranslator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251998417,"owners_count":21677980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gui-application","neural-machine-translation","opennmt"],"created_at":"2024-08-02T16:00:27.691Z","updated_at":"2025-05-02T06:31:22.761Z","avatar_url":"https://github.com/ymoslem.png","language":"Python","readme":"[![DesktopTranslator](https://img.shields.io/badge/Download-Windows_Installer-blue)](https://bit.ly/3sNz8qh)\n[![DesktopTranslator](https://img.shields.io/badge/Download-macOS_App-red)](https://bit.ly/3rTS6wa)\n\n# DesktopTranslator\nLocal cross-platform machine translation GUI, based on [CTranslate2](https://github.com/OpenNMT/CTranslate2)\n\n![DesktopTranslator](img/DesktopTranslator-NEW.png)\n\n**Table of contents**\n\n1. [Download DesktopTranslator](#download-desktoptranslator)\n1. [Translation Models](#translation-models)\n    * [French-to-English Generic Model](#french-to-english-generic-model)\n    * [M2M-100 Multilingual Model](#m2m-100-multilingual-model)\n1. [[Optional] Build Stand-alone Executable](#build-stand-alone-executable)\n   * [Build Windows Installer](#build-windows-installer)\n   * [Build macOS App](#build-macos-app)\n1. [References](#references)\n\n    \n## Download DesktopTranslator\n   \n[![DesktopTranslator](https://img.shields.io/badge/Download-Windows_Installer-blue)](https://bit.ly/3sNz8qh)\n[![DesktopTranslator](https://img.shields.io/badge/Download-macOS_App-red)](https://bit.ly/3rTS6wa)\n\n\u003cimg src=\"img/installer.png\" width=\"60%\"\u003e\n\n\n## Translation Models\n\nCurrently, 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 the CTranslate2 format](https://github.com/OpenNMT/CTranslate2#quickstart).\n\n### French-to-English Generic Model\n\nIf 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](https://pretrained-nmt-models.s3.us-west-2.amazonaws.com/CTranslate2/fren/fren.zip). \n1. 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).\n2. In DesktopTranslator, click the \u003ckbd\u003eCTranslate2 Model\u003c/kbd\u003e button, and select the `ct2_model` folder.\n3. Click the \u003ckbd\u003eSentencePiece Model\u003c/kbd\u003e button, navigate to the `sp_model` folder, and select `fr.model`.\n4. The default \u003ckbd\u003eBeam Size\u003c/kbd\u003e is 3. You can increase it to 5, which can be slower, but sometimes results in better translation quality.\n5. In the left input text-area, type some text in French or use the \u003ckbd\u003eFile\u003c/kbd\u003e menu \\\u003e \u003ckbd\u003eOpen...\u003c/kbd\u003e to open a *.txt file.\n6. Click the \u003ckbd\u003eTranslate\u003c/kbd\u003e button.\n\n### M2M-100 Multilingual Model\n\nNow, DesktopTranslator supports [**M2M-100**](https://github.com/pytorch/fairseq/tree/main/examples/m2m_100) ([Fan et al., 2020](https://arxiv.org/abs/2010.11125)), a multilingual model that can translate between 100 languages.\n    \n\u003ckbd\u003e ![DesktopTranslator](img/DesktopTranslator_M2M-100.png)\n\nTo use M2M-100 models in DesktopTranslator, please follow these steps:\n1. Download one of the M2M-100 models, converted to the CTranslate2 format:  \n    a. [M2M-100 418M-parameter model](https://bit.ly/33fM1AO); smaller and faster, but sometimes less accurate; or  \n    b. [M2M-100 1.2B-parameter model](https://bit.ly/3GYiaed); bigger and somehow slower, but sometimes more accurate.\n2. Extract the *.zip arhieve of the model you downloaded.\n3. In DesktopTranslator, click the \u003ckbd\u003eCTranslate2 Model\u003c/kbd\u003e button, and select the `m2m100_418m` or `m2m100_12b` folder.\n4. Click the \u003ckbd\u003eSentencePiece Model\u003c/kbd\u003e button, and from the same model folder, select `sentencepiece.model`.\n5. **Important:** From the \u003ckbd\u003eM2M-100\u003c/kbd\u003e dropdown list, select the target language to which you want to translate. This step is different between M2M-100 and some other models. M2M-100 models require a language code prefix. For other models that do not require this, keep the \"None\" option.\n6. The default \u003ckbd\u003eBeam Size\u003c/kbd\u003e is 3. You can increase it to 5, which can be slower, but sometimes results in better translation quality.\n7. In the left input text-area, type some text in any language or your choice of use the \u003ckbd\u003eFile\u003c/kbd\u003e menu \\\u003e \u003ckbd\u003eOpen...\u003c/kbd\u003e to open a *.txt file.\n8. Click the \u003ckbd\u003eTranslate\u003c/kbd\u003e button.\n   \n### OPUS Models\n\nOPUS models ([Tatoeba-Challenge](https://github.com/Helsinki-NLP/Tatoeba-Challenge/tree/master/models)) can be used and they can be more efficient. As of now, only _bilingual_ models are supported by DesktopTranslator. Note: You must convert an OPUS model to the CTranslate2 format first. Example command:\n```\nct2-opus-mt-converter --model_dir opus_model_dir --output_dir ct2_model_dir --quantization int8\n```\nThe source and target tokenization SentencePiece models can be found in the same archive of the downloaded model.\n\n## [Optional] Build Stand-alone Executable\n   \n### Build Windows Installer\n\nIf you want to adjust the code and then build an installer yourself, you can follow these steps:\n\n1. Install PyInstaller:\n```\npip3 install pyinstaller\n```\n\n2. To use PyInstaller, specify the Python file name and the argument -w to hide the console window:\n```\npyinstaller -y -w \"translator.py\"\n```\nIf you would like to add an extra folder, e.g. \"utils\", the command will be:\n```\npyinstaller -y -w --add-data=\"utils/*;utils/\" \"translator.py\"\n```\n3. 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](https://gist.github.com/ymoslem/c4b0cd287c7d5f2b7279dfce354d389b) to the same folder as the `translate.py` and run the aforementioned PyInstaller command again.\n4. Compress the contents of the “dist” directory created by PyInstaller into a *.zip archive. For example, you can find a folder called \"translator\"; give it the name you like, e.g. \"DesktopTranslator\", and add it to a *.zip archive.\n5. Download and install [NSIS](https://nsis.sourceforge.io/Download).\n6. Launch NSIS, click **Installer based on a .ZIP file**, and then click **Open** to locate the **\\*.zip** archive you have just created.\n7. If you want to make the files installed (extracted) to the “Program Files” of the target user, in the **Default Folder** enter `$PROGRAMFILES`\n8. 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 file 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.\n```\nSection \"Desktop Shortcut\" SectionX\n    SetShellVarContext current\n    CreateShortCut \"$DESKTOP\\DesktopTranslator.lnk\" \"$PROGRAMFILES\\DesktopTranslator\\translator.exe\"\nSectionEnd\n```\nIf you get a permission error while trying to save the edited version of “Modern.nsh”, right-click your text editor (e.g. _Notepad_), and select \"Run as administrator\". Then, copy the contents of the file into a new file, and save it to the original location.  \n9. 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.\n10. After installation, if you applied step \\#8, you should find an icon on the Desktop. To uninstall, you can simply remove the app folder from \"Program Files\". For more NSIS options, check this [example](https://nsis.sourceforge.io/A_simple_installer_with_start_menu_shortcut_and_uninstaller).\n\n### Build macOS App\n\n1. Install `py2app`\n```\npip3 install py2app==0.25\n```\n2. Create a [setup.py](https://gist.github.com/ymoslem/e0c88f30181191d57c374b6cdad9317c) file in the same directory.\n3. Run this command in the Terminal. You can add the option `-A` to test the app first.\n```\npython3 setup.py py2app\n```\n\n\n## References\n\n* [Efficient and High-Quality Neural Machine Translation with OpenNMT, Klein et al., 2020](https://aclanthology.org/2020.ngt-1.25/)\n* [Beyond English-Centric Multilingual Machine Translation, Fan et al., 2020](https://arxiv.org/abs/2010.11125)\n","funding_links":[],"categories":["Applications 💻"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymoslem%2FDesktopTranslator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fymoslem%2FDesktopTranslator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymoslem%2FDesktopTranslator/lists"}