翻译工具Crow Translate及其编译

Crow Translate 是一款实用的多语种翻译软件,软件支持的翻译语言有很多种,包括英语、日语、韩语、德语等,并支持翻译后进行朗读,还能够批量翻译文本,非常适用于经常需要将句子快速翻译为多种语言的所有用户。软件的使用方法也非常的简单,你只需要在左侧面板中输入源文本,并在右侧面板中显示翻译即可,在此过程中你可以选择需要翻译的语言以及目标语言,非常方便。该软件与其他类似的软件不同,在这里你可以直接在使用过程中创建目标语言列表,然后单击鼠标即可轻松在它们之间切换,如果你想对单个单词进行深入的定义,也可以像词典一样显示信息以及词性的类型,翻译和各种上下文示例。

 

功能特点
    速度:该程序是用C ++ / Qt编写的,消耗约20 MB的RAM
    开源的:Crow Translate已获得GPL v3许可证的许可,这意味着您可以免费使用和修改它
    多种语言:感谢Google,Yandex和Bing,您可以翻译成117种不同的语言
    CLI界面:您可以直接在终端中翻译文本
    选择/ OCR:翻译和说出屏幕或所选内容中的文字
    跨平台:适用于Linux和Windows

-----------------------------------------------

A simple and lightweight translator that allows you to translate and speak text using Google, Yandex Bing, LibreTranslate and Lingva. 

https://crow-translate.github.io/

GitHub (pre-)release Crowdin

Crow Translate is a simple and lightweight translator written in C++ / Qt that allows you to translate and speak text using Google, Yandex, Bing, LibreTranslate and Lingva translate API. You may also be interested in my library QOnlineTranslator used in this project.

Screenshots

Plasma

Main

Plasma Mobile

Main

Windows 10

Main

Features

  • Translate and speak text from screen or selection
  • Support 125 different languages
  • Low memory consumption (~20MB)
  • Highly customizable shortcuts
  • Command-line interface with rich options
  • D-Bus API
  • Available for Linux and Windows

CLI commands

The program also has a console interface.

Usage: crow [options] text

Option Description
-h, --help Display help
-v, --version Display version information
-c, --codes Display language codes
-s, --source <code> Specify the source language (by default, engine will try to determine the language on its own)
-t, --translation <code> Specify the translation language(s), splitted by '+' (by default, the system language is used)
-l, --locale <code> Specify the translator language (by default, the system language is used)
-e, --engine <engine> Specify the translator engine ('google', 'yandex', 'bing', 'libretranslate' or 'lingva'), Google is used by default
-p, --speak-translation Speak the translation
-u, --speak-source Speak the source
-f, --file Read source text from files. Arguments will be interpreted as file paths
-i, --stdin Add stdin data to source text
-a, --audio-only Print text only for speaking when using --speak-translation or --speak-source
-b, --brief Print only translations
-j, --json Print output formatted as JSON

Note: If you do not pass startup arguments to the program, the GUI starts.

Dependencies

Required

Optional

External libraries

This project uses the following external libraries, which included as git submodules:

  • QOnlineTranslator - provides free usage of Google, Yandex and Bing translate API.
  • QGitTag - uses the GitHub API to provide information about releases.
  • QHotkey - provides global shortcuts for desktop platforms.
  • QTaskbarControl - to create a taskbar/launcher progress for all desktop platforms.
  • SingleApplication - prevents launch of multiple application instances.

Icons

Fluent icon theme is bundled to provide icons on Windows and fallback icons on Linux.

circle-flags icons are used for flags.

Installation

Downloads are available on the Releases page. Also check out the website for other installation methods.

Note: On Linux to make the application look native on a non-KDE desktop environment, you need to configure Qt applications styling. This can be done by using qt5ct or adwaita-qt5 or qtstyleplugins. Please check the appropriate installation guide for your distribution.

Note: Windows requires Microsoft Visual C++ Redistributable 2019 to work.

Building

Building executable

You can build Crow Translate by using the following commands:

mkdir build
cd build
cmake .. # Or `cmake -D CMAKE_BUILD_TYPE=Release ..` for single-configuration generators such as Ninja or GNU Make
cmake --build . # Or `cmake --build . --config Release` for multi-config generators such as Visual Studio Generators or Xcode

You will then get a binary named crow.

Building a package using CPack

CMake can create specified package types automatically.

If you use Makefile, Ninja, or Xcode generator you can use package target:

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CPACK_GENERATOR=DEB .. # You can specify several types of packages separated by semicolons in double quotes, for example: `CPACK_GENERATOR="DEB;ZIP;NSIS"`
cmake --build . --target package

Or you can use CPack utility for any generators:

mkdir build
cd build
cmake .. # Or `cmake -D CMAKE_BUILD_TYPE=Release ..` for single-configuration generators such as Ninja or GNU Make
cpack -G DEB # Or `cpack -G DEB -C Release` for multi-config generators such as Visual Studio Generators or Xcode

On Windows you need VCPKG to bundle all necessary DLLs.

Build parameters

  • WITH_PORTABLE_MODE - Enable portable functionality. If you create file named settings.ini in the app folder and Crow will store the configuration in it. It also adds the “Portable Mode” option to the application settings, which does the same.
  • WITH_KWAYLAND - Find and use KWayland library for better Wayland integration.

Build parameters are passed at configuration stage: cmake -D WITH_PORTABLE_MODE ...

Localization

To help with localization you can use Crowdin or translate files in data/translations with Qt Linguist directly. To add a new language, write me on the Crowdin page or copy data/translations/crow-translate.ts to data/translations/crow-translate_<ISO 639-1 language code>_<ISO 3166-1 country code>.ts, translate it and send a pull request.

from 

https://github.com/crow-translate/crow-translate