Merge branch 'develop'
This commit is contained in:
commit
34081855cd
@ -14,6 +14,7 @@ branches:
|
|||||||
- /.*travis/
|
- /.*travis/
|
||||||
os:
|
os:
|
||||||
- linux
|
- linux
|
||||||
email:
|
notifications:
|
||||||
|
email:
|
||||||
on_success: change
|
on_success: change
|
||||||
on_failure: change
|
on_failure: change
|
||||||
|
@ -30,6 +30,7 @@ namespace settings_names {
|
|||||||
//! Translation
|
//! Translation
|
||||||
const QString translationGroup = "Translation";
|
const QString translationGroup = "Translation";
|
||||||
const QString doTranslation = "doTranslation";
|
const QString doTranslation = "doTranslation";
|
||||||
|
const QString ignoreSslErrors = "ignoreSslErrors";
|
||||||
const QString sourceLanguage = "source_language";
|
const QString sourceLanguage = "source_language";
|
||||||
const QString translationLanguage = "translation_language";
|
const QString translationLanguage = "translation_language";
|
||||||
const QString translationTimeout = "translation_timeout";
|
const QString translationTimeout = "translation_timeout";
|
||||||
@ -67,6 +68,7 @@ namespace settings_values {
|
|||||||
|
|
||||||
//! Translation
|
//! Translation
|
||||||
const bool doTranslation = true;
|
const bool doTranslation = true;
|
||||||
|
const bool ignoreSslErrors = false;
|
||||||
const QString sourceLanguage = "auto";
|
const QString sourceLanguage = "auto";
|
||||||
const QString translationLanguage = "ru";
|
const QString translationLanguage = "ru";
|
||||||
const int translationTimeout = 15; // secs
|
const int translationTimeout = 15; // secs
|
||||||
|
@ -128,6 +128,7 @@ void SettingsEditor::saveSettings () const {
|
|||||||
|
|
||||||
settings.beginGroup (translationGroup);
|
settings.beginGroup (translationGroup);
|
||||||
settings.setValue (doTranslation, ui->doTranslationCheck->isChecked ());
|
settings.setValue (doTranslation, ui->doTranslationCheck->isChecked ());
|
||||||
|
settings.setValue (ignoreSslErrors, ui->ignoreSslCheck->isChecked ());
|
||||||
settings.setValue (translationDebugMode, ui->translatorDebugCheck->isChecked ());
|
settings.setValue (translationDebugMode, ui->translatorDebugCheck->isChecked ());
|
||||||
QString trLanguage = dictionary_.translateUiToCode (ui->translateLangCombo->currentText ());
|
QString trLanguage = dictionary_.translateUiToCode (ui->translateLangCombo->currentText ());
|
||||||
settings.setValue (translationLanguage, trLanguage);
|
settings.setValue (translationLanguage, trLanguage);
|
||||||
@ -216,6 +217,7 @@ void SettingsEditor::loadSettings () {
|
|||||||
|
|
||||||
settings.beginGroup (settings_names::translationGroup);
|
settings.beginGroup (settings_names::translationGroup);
|
||||||
ui->doTranslationCheck->setChecked (GET (doTranslation).toBool ());
|
ui->doTranslationCheck->setChecked (GET (doTranslation).toBool ());
|
||||||
|
ui->ignoreSslCheck->setChecked (GET (ignoreSslErrors).toBool ());
|
||||||
ui->translatorDebugCheck->setChecked (GET (translationDebugMode).toBool ());
|
ui->translatorDebugCheck->setChecked (GET (translationDebugMode).toBool ());
|
||||||
QString trLanguage = dictionary_.translateCodeToUi (GET (translationLanguage).toString ());
|
QString trLanguage = dictionary_.translateCodeToUi (GET (translationLanguage).toString ());
|
||||||
ui->translateLangCombo->setCurrentText (trLanguage);
|
ui->translateLangCombo->setCurrentText (trLanguage);
|
||||||
|
@ -378,7 +378,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" colspan="2">
|
<item row="0" column="1">
|
||||||
<widget class="QCheckBox" name="translatorDebugCheck">
|
<widget class="QCheckBox" name="translatorDebugCheck">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Отображает окно переводчика. Следует использовать только для разработки переводчиков.</p></body></html></string>
|
<string><html><head/><body><p>Отображает окно переводчика. Следует использовать только для разработки переводчиков.</p></body></html></string>
|
||||||
@ -388,6 +388,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QCheckBox" name="ignoreSslCheck">
|
||||||
|
<property name="text">
|
||||||
|
<string>Игнорировать ошибки SSL</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_9">
|
<widget class="QLabel" name="label_9">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -398,6 +405,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<widget class="QSpinBox" name="translateTimeoutSpin">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> сек.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -411,6 +425,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="1" colspan="2">
|
||||||
|
<widget class="QComboBox" name="translateLangCombo"/>
|
||||||
|
</item>
|
||||||
<item row="3" column="0" colspan="3">
|
<item row="3" column="0" colspan="3">
|
||||||
<widget class="QLabel" name="label_10">
|
<widget class="QLabel" name="label_10">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -421,16 +438,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" colspan="2">
|
|
||||||
<widget class="QComboBox" name="translateLangCombo"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" colspan="2">
|
|
||||||
<widget class="QSpinBox" name="translateTimeoutSpin">
|
|
||||||
<property name="suffix">
|
|
||||||
<string> сек.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="3">
|
<item row="4" column="0" colspan="3">
|
||||||
<widget class="QListWidget" name="translatorList">
|
<widget class="QListWidget" name="translatorList">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
WebTranslator::WebTranslator ()
|
WebTranslator::WebTranslator ()
|
||||||
: QObject (),
|
: QObject (),
|
||||||
proxy_ (new WebTranslatorProxy (this)), view_ (new QWebView),
|
proxy_ (new WebTranslatorProxy (this)), view_ (new QWebView),
|
||||||
translatorHelper_ (new TranslatorHelper), isReady_ (true) {
|
translatorHelper_ (new TranslatorHelper), isReady_ (true),
|
||||||
|
ignoreSslErrors_ (settings_values::ignoreSslErrors){
|
||||||
|
|
||||||
view_->settings ()->setAttribute (QWebSettings::AutoLoadImages, false);
|
view_->settings ()->setAttribute (QWebSettings::AutoLoadImages, false);
|
||||||
view_->settings ()->setAttribute (QWebSettings::DeveloperExtrasEnabled, true);
|
view_->settings ()->setAttribute (QWebSettings::DeveloperExtrasEnabled, true);
|
||||||
@ -25,6 +26,9 @@ WebTranslator::WebTranslator ()
|
|||||||
this, SLOT (addProxyToView ()));
|
this, SLOT (addProxyToView ()));
|
||||||
connect (view_->page ()->networkAccessManager (), SIGNAL (finished (QNetworkReply *)),
|
connect (view_->page ()->networkAccessManager (), SIGNAL (finished (QNetworkReply *)),
|
||||||
this, SLOT (replyFinished (QNetworkReply *)));
|
this, SLOT (replyFinished (QNetworkReply *)));
|
||||||
|
connect (view_->page ()->networkAccessManager (),
|
||||||
|
SIGNAL (sslErrors (QNetworkReply *, QList<QSslError>)),
|
||||||
|
this, SLOT (handleSslErrors (QNetworkReply *, QList<QSslError>)));
|
||||||
|
|
||||||
translationTimeout_.setSingleShot (true);
|
translationTimeout_.setSingleShot (true);
|
||||||
connect (&translationTimeout_, SIGNAL (timeout ()), SLOT (abortTranslation ()));
|
connect (&translationTimeout_, SIGNAL (timeout ()), SLOT (abortTranslation ()));
|
||||||
@ -76,6 +80,12 @@ void WebTranslator::proxyTranslated (const QString &text) {
|
|||||||
finishTranslation (false);
|
finishTranslation (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebTranslator::handleSslErrors (QNetworkReply *reply, const QList<QSslError> &) {
|
||||||
|
if (ignoreSslErrors_) {
|
||||||
|
reply->ignoreSslErrors ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WebTranslator::abortTranslation () {
|
void WebTranslator::abortTranslation () {
|
||||||
if (!tryNextTranslator ()) {
|
if (!tryNextTranslator ()) {
|
||||||
emit error (tr ("Перевод отменен по таймауту."));
|
emit error (tr ("Перевод отменен по таймауту."));
|
||||||
@ -134,6 +144,8 @@ void WebTranslator::applySettings () {
|
|||||||
}
|
}
|
||||||
bool debugMode = GET (translationDebugMode).toBool ();
|
bool debugMode = GET (translationDebugMode).toBool ();
|
||||||
setDebugMode (debugMode);
|
setDebugMode (debugMode);
|
||||||
|
|
||||||
|
ignoreSslErrors_ = GET(ignoreSslErrors).toBool ();
|
||||||
#undef GET
|
#undef GET
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
class QWebView;
|
class QWebView;
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
|
class QSslError;
|
||||||
|
|
||||||
class WebTranslatorProxy;
|
class WebTranslatorProxy;
|
||||||
class TranslatorHelper;
|
class TranslatorHelper;
|
||||||
@ -35,6 +36,7 @@ class WebTranslator : public QObject {
|
|||||||
void addProxyToView ();
|
void addProxyToView ();
|
||||||
void abortTranslation ();
|
void abortTranslation ();
|
||||||
void proxyTranslated (const QString &text);
|
void proxyTranslated (const QString &text);
|
||||||
|
void handleSslErrors (QNetworkReply *reply, const QList<QSslError> &errors);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void translateQueued ();
|
void translateQueued ();
|
||||||
@ -47,6 +49,7 @@ class WebTranslator : public QObject {
|
|||||||
TranslatorHelper *translatorHelper_;
|
TranslatorHelper *translatorHelper_;
|
||||||
QVector<ProcessingItem> queue_;
|
QVector<ProcessingItem> queue_;
|
||||||
bool isReady_;
|
bool isReady_;
|
||||||
|
bool ignoreSslErrors_;
|
||||||
QTimer translationTimeout_;
|
QTimer translationTimeout_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ cleanupDirInNeeded $APP_DIR
|
|||||||
|
|
||||||
cd $APP_DIR
|
cd $APP_DIR
|
||||||
echo "Building app"
|
echo "Building app"
|
||||||
lrelease $QT_CHOOSER $SRC_DIR/ScreenTranslator.pro
|
$QT_LRELEASE $QT_CHOOSER $SRC_DIR/ScreenTranslator.pro
|
||||||
$QMAKE $QT_CHOOSER "CONFIG-=debug_and_release" "CONFIG+=release" $SRC_DIR
|
$QMAKE $QT_CHOOSER "CONFIG-=debug_and_release" "CONFIG+=release" $SRC_DIR
|
||||||
make $JOBS
|
make $JOBS
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ CLEAN=false
|
|||||||
JOBS=""
|
JOBS=""
|
||||||
QT_CHOOSER="-qt=qt5"
|
QT_CHOOSER="-qt=qt5"
|
||||||
QMAKE=qmake
|
QMAKE=qmake
|
||||||
|
QT_LRELEASE=lrelease
|
||||||
QT_LIB_DIR=/usr/lib/x86_64-linux-gnu
|
QT_LIB_DIR=/usr/lib/x86_64-linux-gnu
|
||||||
STRIP=strip
|
STRIP=strip
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ for arg in ${@}; do
|
|||||||
"clean" ) CLEAN=true;;
|
"clean" ) CLEAN=true;;
|
||||||
"-j"* ) JOBS=$arg;;
|
"-j"* ) JOBS=$arg;;
|
||||||
*"qmake" ) QMAKE=$arg
|
*"qmake" ) QMAKE=$arg
|
||||||
|
QT_LRELEASE=`readlink -e $(dirname $arg)/lrelease`
|
||||||
QT_LIB_DIR=`readlink -e $(dirname $arg)/../lib`
|
QT_LIB_DIR=`readlink -e $(dirname $arg)/../lib`
|
||||||
QT_CHOOSER=""
|
QT_CHOOSER=""
|
||||||
;;
|
;;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="103"/>
|
<location filename="../Manager.cpp" line="103"/>
|
||||||
<location filename="../Manager.cpp" line="365"/>
|
<location filename="../Manager.cpp" line="363"/>
|
||||||
<location filename="../Manager.cpp" line="424"/>
|
<location filename="../Manager.cpp" line="424"/>
|
||||||
<source>Результат</source>
|
<source>Результат</source>
|
||||||
<translation>Result</translation>
|
<translation>Result</translation>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="109"/>
|
<location filename="../Manager.cpp" line="109"/>
|
||||||
<location filename="../Manager.cpp" line="353"/>
|
<location filename="../Manager.cpp" line="351"/>
|
||||||
<source>О программе</source>
|
<source>О программе</source>
|
||||||
<translation>About</translation>
|
<translation>About</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -73,12 +73,12 @@
|
|||||||
%1</translation>
|
%1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="288"/>
|
<location filename="../Manager.cpp" line="286"/>
|
||||||
<source>Не найден подходящий язык распознавания.</source>
|
<source>Не найден подходящий язык распознавания.</source>
|
||||||
<translation>Failed to find selected recognition language.</translation>
|
<translation>Failed to find selected recognition language.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="334"/>
|
<location filename="../Manager.cpp" line="332"/>
|
||||||
<source>Программа для распознавания текста на экране.
|
<source>Программа для распознавания текста на экране.
|
||||||
Создана с использованием Qt, tesseract-ocr, Google Translate.
|
Создана с использованием Qt, tesseract-ocr, Google Translate.
|
||||||
Автор: Gres (translator@gres.biz)
|
Автор: Gres (translator@gres.biz)
|
||||||
@ -86,7 +86,7 @@
|
|||||||
<translation>Screen text recognition and translation program. \n Uses Qt, tesseract-ocr, Google Translate. \n Author: Gres (translator@gres.biz) \n Version: %1 from %2 %3</translation>
|
<translation>Screen text recognition and translation program. \n Uses Qt, tesseract-ocr, Google Translate. \n Author: Gres (translator@gres.biz) \n Version: %1 from %2 %3</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="339"/>
|
<location filename="../Manager.cpp" line="337"/>
|
||||||
<source>
|
<source>
|
||||||
|
|
||||||
Подсказки.
|
Подсказки.
|
||||||
@ -113,17 +113,17 @@ Key modifiers what capturing :
|
|||||||
</translation>
|
</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="366"/>
|
<location filename="../Manager.cpp" line="364"/>
|
||||||
<source>Последний результат был скопирован в буфер обмена.</source>
|
<source>Последний результат был скопирован в буфер обмена.</source>
|
||||||
<translation>Last result has been copied to clipboard.</translation>
|
<translation>Last result has been copied to clipboard.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="376"/>
|
<location filename="../Manager.cpp" line="374"/>
|
||||||
<source>Правка</source>
|
<source>Правка</source>
|
||||||
<translation>Correction</translation>
|
<translation>Correction</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="376"/>
|
<location filename="../Manager.cpp" line="374"/>
|
||||||
<source>Исправьте распознанный текст</source>
|
<source>Исправьте распознанный текст</source>
|
||||||
<translation>Correct recognized text</translation>
|
<translation>Correct recognized text</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -736,27 +736,27 @@ Key modifiers what capturing :
|
|||||||
<translation>Result</translation>
|
<translation>Result</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ResultDialog.cpp" line="49"/>
|
<location filename="../ResultDialog.cpp" line="50"/>
|
||||||
<source>Распознать другой язык</source>
|
<source>Распознать другой язык</source>
|
||||||
<translation>Recognize another language</translation>
|
<translation>Recognize another language</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ResultDialog.cpp" line="50"/>
|
<location filename="../ResultDialog.cpp" line="51"/>
|
||||||
<source>Перевести на другой язык</source>
|
<source>Перевести на другой язык</source>
|
||||||
<translation>Translate to another language</translation>
|
<translation>Translate to another language</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ResultDialog.cpp" line="51"/>
|
<location filename="../ResultDialog.cpp" line="52"/>
|
||||||
<source>Скопировать в буфер</source>
|
<source>Скопировать в буфер</source>
|
||||||
<translation>Copy to clipboard</translation>
|
<translation>Copy to clipboard</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ResultDialog.cpp" line="52"/>
|
<location filename="../ResultDialog.cpp" line="53"/>
|
||||||
<source>Скопировать рисунок в буфер</source>
|
<source>Скопировать рисунок в буфер</source>
|
||||||
<translation>Copy image to clibpoard</translation>
|
<translation>Copy image to clibpoard</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ResultDialog.cpp" line="53"/>
|
<location filename="../ResultDialog.cpp" line="54"/>
|
||||||
<source>Исправить распознанный текст</source>
|
<source>Исправить распознанный текст</source>
|
||||||
<translation>Correct recognized text</translation>
|
<translation>Correct recognized text</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -846,7 +846,7 @@ Key modifiers what capturing :
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="277"/>
|
<location filename="../SettingsEditor.ui" line="277"/>
|
||||||
<location filename="../SettingsEditor.cpp" line="153"/>
|
<location filename="../SettingsEditor.cpp" line="154"/>
|
||||||
<source>Путь к tessdata</source>
|
<source>Путь к tessdata</source>
|
||||||
<translation>Tessdata path</translation>
|
<translation>Tessdata path</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -1001,36 +1001,41 @@ Key modifiers what capturing :
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="394"/>
|
<location filename="../SettingsEditor.ui" line="394"/>
|
||||||
|
<source>Игнорировать ошибки SSL</source>
|
||||||
|
<translation>Ignore SSL errors</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../SettingsEditor.ui" line="401"/>
|
||||||
<source><html><head/><body><p>Максимальное время, которое может быть затрачено на перевод, чтобы он не считался &quot;зависшим&quot;.</p></body></html></source>
|
<source><html><head/><body><p>Максимальное время, которое может быть затрачено на перевод, чтобы он не считался &quot;зависшим&quot;.</p></body></html></source>
|
||||||
<translation><html><head/><body><p>Max time of translation process.</p></body></html></translation>
|
<translation><html><head/><body><p>Max time of translation process.</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="397"/>
|
<location filename="../SettingsEditor.ui" line="404"/>
|
||||||
<source>Максимальное время перевода:</source>
|
<source>Максимальное время перевода:</source>
|
||||||
<translation>Max translation time:</translation>
|
<translation>Max translation time:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="404"/>
|
<location filename="../SettingsEditor.ui" line="418"/>
|
||||||
<source><html><head/><body><p>Язык, на который осуществляется перевод.</p></body></html></source>
|
<source><html><head/><body><p>Язык, на который осуществляется перевод.</p></body></html></source>
|
||||||
<translation><html><head/><body><p>Translated text language.</p></body></html></translation>
|
<translation><html><head/><body><p>Translated text language.</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="407"/>
|
<location filename="../SettingsEditor.ui" line="421"/>
|
||||||
<source>Язык результата:</source>
|
<source>Язык результата:</source>
|
||||||
<translation>Translation language:</translation>
|
<translation>Translation language:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="417"/>
|
<location filename="../SettingsEditor.ui" line="434"/>
|
||||||
<source>Переводчики:</source>
|
<source>Переводчики:</source>
|
||||||
<translation>Translators:</translation>
|
<translation>Translators:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="430"/>
|
<location filename="../SettingsEditor.ui" line="411"/>
|
||||||
<source> сек.</source>
|
<source> сек.</source>
|
||||||
<translation>secs.</translation>
|
<translation>secs.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="437"/>
|
<location filename="../SettingsEditor.ui" line="444"/>
|
||||||
<source><html><head/><body><p>Отображены в порядке убывания приоритета.</p></body></html></source>
|
<source><html><head/><body><p>Отображены в порядке убывания приоритета.</p></body></html></source>
|
||||||
<translation><html><head/><body><p>Sorted by priority descending.</p></body></html></translation>
|
<translation><html><head/><body><p>Sorted by priority descending.</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -1446,17 +1451,17 @@ Change dirs permissions and try again or perform manual update.</translation>
|
|||||||
<context>
|
<context>
|
||||||
<name>WebTranslator</name>
|
<name>WebTranslator</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../WebTranslator.cpp" line="81"/>
|
<location filename="../WebTranslator.cpp" line="88"/>
|
||||||
<source>Перевод отменен по таймауту.</source>
|
<source>Перевод отменен по таймауту.</source>
|
||||||
<translation>Translation timed out.</translation>
|
<translation>Translation timed out.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../WebTranslator.cpp" line="89"/>
|
<location filename="../WebTranslator.cpp" line="96"/>
|
||||||
<source>Ошибка загрузки страницы (%1) для перевода.</source>
|
<source>Ошибка загрузки страницы (%1) для перевода.</source>
|
||||||
<translation>Page (%1) load failed.</translation>
|
<translation>Page (%1) load failed.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../WebTranslator.cpp" line="133"/>
|
<location filename="../WebTranslator.cpp" line="140"/>
|
||||||
<source>Нет сценариев для перевода. Измените настройки.</source>
|
<source>Нет сценариев для перевода. Измените настройки.</source>
|
||||||
<translation>Not found any translators. Change settings.</translation>
|
<translation>Not found any translators. Change settings.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="103"/>
|
<location filename="../Manager.cpp" line="103"/>
|
||||||
<location filename="../Manager.cpp" line="365"/>
|
<location filename="../Manager.cpp" line="363"/>
|
||||||
<location filename="../Manager.cpp" line="424"/>
|
<location filename="../Manager.cpp" line="424"/>
|
||||||
<source>Результат</source>
|
<source>Результат</source>
|
||||||
<translation>Результат</translation>
|
<translation>Результат</translation>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="109"/>
|
<location filename="../Manager.cpp" line="109"/>
|
||||||
<location filename="../Manager.cpp" line="353"/>
|
<location filename="../Manager.cpp" line="351"/>
|
||||||
<source>О программе</source>
|
<source>О программе</source>
|
||||||
<translation>О программе</translation>
|
<translation>О программе</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -73,12 +73,12 @@
|
|||||||
%1</translation>
|
%1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="288"/>
|
<location filename="../Manager.cpp" line="286"/>
|
||||||
<source>Не найден подходящий язык распознавания.</source>
|
<source>Не найден подходящий язык распознавания.</source>
|
||||||
<translation>Не найден подходящий язык распознавания.</translation>
|
<translation>Не найден подходящий язык распознавания.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="334"/>
|
<location filename="../Manager.cpp" line="332"/>
|
||||||
<source>Программа для распознавания текста на экране.
|
<source>Программа для распознавания текста на экране.
|
||||||
Создана с использованием Qt, tesseract-ocr, Google Translate.
|
Создана с использованием Qt, tesseract-ocr, Google Translate.
|
||||||
Автор: Gres (translator@gres.biz)
|
Автор: Gres (translator@gres.biz)
|
||||||
@ -89,7 +89,7 @@
|
|||||||
Версия: %1 от %2 %3</translation>
|
Версия: %1 от %2 %3</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="339"/>
|
<location filename="../Manager.cpp" line="337"/>
|
||||||
<source>
|
<source>
|
||||||
|
|
||||||
Подсказки.
|
Подсказки.
|
||||||
@ -116,17 +116,17 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="366"/>
|
<location filename="../Manager.cpp" line="364"/>
|
||||||
<source>Последний результат был скопирован в буфер обмена.</source>
|
<source>Последний результат был скопирован в буфер обмена.</source>
|
||||||
<translation>Последний результат был скопирован в буфер обмена.</translation>
|
<translation>Последний результат был скопирован в буфер обмена.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="376"/>
|
<location filename="../Manager.cpp" line="374"/>
|
||||||
<source>Правка</source>
|
<source>Правка</source>
|
||||||
<translation>Правка</translation>
|
<translation>Правка</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../Manager.cpp" line="376"/>
|
<location filename="../Manager.cpp" line="374"/>
|
||||||
<source>Исправьте распознанный текст</source>
|
<source>Исправьте распознанный текст</source>
|
||||||
<translation>Исправьте распознанный текст</translation>
|
<translation>Исправьте распознанный текст</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -741,27 +741,27 @@
|
|||||||
<translation>Результат</translation>
|
<translation>Результат</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ResultDialog.cpp" line="49"/>
|
<location filename="../ResultDialog.cpp" line="50"/>
|
||||||
<source>Распознать другой язык</source>
|
<source>Распознать другой язык</source>
|
||||||
<translation>Распознать другой язык</translation>
|
<translation>Распознать другой язык</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ResultDialog.cpp" line="50"/>
|
<location filename="../ResultDialog.cpp" line="51"/>
|
||||||
<source>Перевести на другой язык</source>
|
<source>Перевести на другой язык</source>
|
||||||
<translation>Перевести на другой язык</translation>
|
<translation>Перевести на другой язык</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ResultDialog.cpp" line="51"/>
|
<location filename="../ResultDialog.cpp" line="52"/>
|
||||||
<source>Скопировать в буфер</source>
|
<source>Скопировать в буфер</source>
|
||||||
<translation>Скопировать в буфер</translation>
|
<translation>Скопировать в буфер</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ResultDialog.cpp" line="52"/>
|
<location filename="../ResultDialog.cpp" line="53"/>
|
||||||
<source>Скопировать рисунок в буфер</source>
|
<source>Скопировать рисунок в буфер</source>
|
||||||
<translation>Скопировать рисунок в буфер</translation>
|
<translation>Скопировать рисунок в буфер</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ResultDialog.cpp" line="53"/>
|
<location filename="../ResultDialog.cpp" line="54"/>
|
||||||
<source>Исправить распознанный текст</source>
|
<source>Исправить распознанный текст</source>
|
||||||
<translation>Исправить распознанный текст</translation>
|
<translation>Исправить распознанный текст</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -851,7 +851,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="277"/>
|
<location filename="../SettingsEditor.ui" line="277"/>
|
||||||
<location filename="../SettingsEditor.cpp" line="153"/>
|
<location filename="../SettingsEditor.cpp" line="154"/>
|
||||||
<source>Путь к tessdata</source>
|
<source>Путь к tessdata</source>
|
||||||
<translation>Путь к tessdata</translation>
|
<translation>Путь к tessdata</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -1006,36 +1006,41 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="394"/>
|
<location filename="../SettingsEditor.ui" line="394"/>
|
||||||
|
<source>Игнорировать ошибки SSL</source>
|
||||||
|
<translation>Игнорировать ошибки SSL</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../SettingsEditor.ui" line="401"/>
|
||||||
<source><html><head/><body><p>Максимальное время, которое может быть затрачено на перевод, чтобы он не считался &quot;зависшим&quot;.</p></body></html></source>
|
<source><html><head/><body><p>Максимальное время, которое может быть затрачено на перевод, чтобы он не считался &quot;зависшим&quot;.</p></body></html></source>
|
||||||
<translation><html><head/><body><p>Максимальное время, которое может быть затрачено на перевод, чтобы он не считался &quot;зависшим&quot;.</p></body></html></translation>
|
<translation><html><head/><body><p>Максимальное время, которое может быть затрачено на перевод, чтобы он не считался &quot;зависшим&quot;.</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="397"/>
|
<location filename="../SettingsEditor.ui" line="404"/>
|
||||||
<source>Максимальное время перевода:</source>
|
<source>Максимальное время перевода:</source>
|
||||||
<translation>Максимальное время перевода:</translation>
|
<translation>Максимальное время перевода:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="404"/>
|
<location filename="../SettingsEditor.ui" line="418"/>
|
||||||
<source><html><head/><body><p>Язык, на который осуществляется перевод.</p></body></html></source>
|
<source><html><head/><body><p>Язык, на который осуществляется перевод.</p></body></html></source>
|
||||||
<translation><html><head/><body><p>Язык, на который осуществляется перевод.</p></body></html></translation>
|
<translation><html><head/><body><p>Язык, на который осуществляется перевод.</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="407"/>
|
<location filename="../SettingsEditor.ui" line="421"/>
|
||||||
<source>Язык результата:</source>
|
<source>Язык результата:</source>
|
||||||
<translation>Язык результата:</translation>
|
<translation>Язык результата:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="417"/>
|
<location filename="../SettingsEditor.ui" line="434"/>
|
||||||
<source>Переводчики:</source>
|
<source>Переводчики:</source>
|
||||||
<translation>Переводчики:</translation>
|
<translation>Переводчики:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="430"/>
|
<location filename="../SettingsEditor.ui" line="411"/>
|
||||||
<source> сек.</source>
|
<source> сек.</source>
|
||||||
<translation> сек.</translation>
|
<translation> сек.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../SettingsEditor.ui" line="437"/>
|
<location filename="../SettingsEditor.ui" line="444"/>
|
||||||
<source><html><head/><body><p>Отображены в порядке убывания приоритета.</p></body></html></source>
|
<source><html><head/><body><p>Отображены в порядке убывания приоритета.</p></body></html></source>
|
||||||
<translation><html><head/><body><p>Отображены в порядке убывания приоритета.</p></body></html></translation>
|
<translation><html><head/><body><p>Отображены в порядке убывания приоритета.</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -1455,17 +1460,17 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>WebTranslator</name>
|
<name>WebTranslator</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../WebTranslator.cpp" line="81"/>
|
<location filename="../WebTranslator.cpp" line="88"/>
|
||||||
<source>Перевод отменен по таймауту.</source>
|
<source>Перевод отменен по таймауту.</source>
|
||||||
<translation>Перевод отменен по таймауту.</translation>
|
<translation>Перевод отменен по таймауту.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../WebTranslator.cpp" line="89"/>
|
<location filename="../WebTranslator.cpp" line="96"/>
|
||||||
<source>Ошибка загрузки страницы (%1) для перевода.</source>
|
<source>Ошибка загрузки страницы (%1) для перевода.</source>
|
||||||
<translation>Ошибка загрузки страницы (%1) для перевода.</translation>
|
<translation>Ошибка загрузки страницы (%1) для перевода.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../WebTranslator.cpp" line="133"/>
|
<location filename="../WebTranslator.cpp" line="140"/>
|
||||||
<source>Нет сценариев для перевода. Измените настройки.</source>
|
<source>Нет сценариев для перевода. Измените настройки.</source>
|
||||||
<translation>Нет сценариев для перевода. Измените настройки.</translation>
|
<translation>Нет сценариев для перевода. Измените настройки.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -6,15 +6,16 @@ function checkFinished () {
|
|||||||
if (!isPageLoaded || !isTranslationFinished || isScheduled) return;
|
if (!isPageLoaded || !isTranslationFinished || isScheduled) return;
|
||||||
isScheduled = true;
|
isScheduled = true;
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
var spans = [].slice.call (document.querySelectorAll ('#OutputText span'));
|
var spans = [].slice.call (document.querySelectorAll ('#destText span'));
|
||||||
var text = spans.reduce (function (res, i) {
|
var text = spans.reduce (function (res, i) {
|
||||||
return res + i.innerText;
|
return res + i.innerText;
|
||||||
}, '');
|
}, '');
|
||||||
st_wtp.translated (text);
|
st_wtp.translated (text);
|
||||||
|
isTranslationFinished = isScheduled = false;
|
||||||
}, 2000); // wait for gui fill
|
}, 2000); // wait for gui fill
|
||||||
}
|
}
|
||||||
function onResourceLoad (url) {
|
function onResourceLoad (url) {
|
||||||
if (url.indexOf ('/api.microsofttranslator.com/') > -1) {
|
if (url.indexOf ('/translator/api/Dictionary/Lookup?') > -1) {
|
||||||
isTranslationFinished = true;
|
isTranslationFinished = true;
|
||||||
checkFinished ();
|
checkFinished ();
|
||||||
}
|
}
|
||||||
@ -27,7 +28,7 @@ function onPageLoad () {
|
|||||||
window.onload = onPageLoad();
|
window.onload = onPageLoad();
|
||||||
|
|
||||||
function translate (){
|
function translate (){
|
||||||
var url = 'https://bing.com/translator/?text=' + st_wtp.sourceText + '#auto/' +
|
var url = 'https://bing.com/translator/?from=auto&to=' + st_wtp.resultLanguage +
|
||||||
st_wtp.resultLanguage;
|
'&text=' + st_wtp.sourceText;
|
||||||
window.location = encodeURI (url);
|
window.location = encodeURI (url);
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,19 @@ function checkFinished () {
|
|||||||
if (!isPageLoaded || !isTranslationFinished || isScheduled) return;
|
if (!isPageLoaded || !isTranslationFinished || isScheduled) return;
|
||||||
isScheduled = true;
|
isScheduled = true;
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
var spans = [].slice.call (document.querySelectorAll ('#translation > span'));
|
var spans = [].slice.call (document.querySelectorAll ('span.translation-chunk'));
|
||||||
var text = spans.reduce (function (res, i) {
|
var text = spans.reduce (function (res, i) {
|
||||||
return res + i.innerText;
|
return res + i.innerText + ' ';
|
||||||
}, '');
|
}, '');
|
||||||
st_wtp.translated (text);
|
st_wtp.translated (text);
|
||||||
|
isTranslationFinished = isScheduled = false;
|
||||||
}, 2000); // wait for gui fill
|
}, 2000); // wait for gui fill
|
||||||
}
|
}
|
||||||
function onResourceLoad (url) {
|
function onResourceLoad (url) {
|
||||||
|
if (url.indexOf ('/tr.json/translate?') > -1) {
|
||||||
|
isTranslationFinished = true;
|
||||||
|
checkFinished ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
st_wtp.resourceLoaded.connect (onResourceLoad);
|
st_wtp.resourceLoaded.connect (onResourceLoad);
|
||||||
function onPageLoad () {
|
function onPageLoad () {
|
||||||
@ -23,9 +28,8 @@ function onPageLoad () {
|
|||||||
window.onload = onPageLoad();
|
window.onload = onPageLoad();
|
||||||
|
|
||||||
function translate (){
|
function translate (){
|
||||||
var url = 'https://translate.yandex.ru/?text=' + st_wtp.sourceText + '&lang=auto-' +
|
var url = 'https://translate.yandex.ru/&lang=' + st_wtp.sourceLanguage + '-' +
|
||||||
st_wtp.resultLanguage;
|
st_wtp.resultLanguage + '?text=' + st_wtp.sourceText ;
|
||||||
url = url.replace(new RegExp(' ','g') , '%20')
|
url = url.replace(new RegExp(' ','g') , '%20')
|
||||||
console.log(encodeURI(url));
|
|
||||||
window.location = (url);
|
window.location = (url);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
"path_linux": "ScreenTranslator"
|
"path_linux": "ScreenTranslator"
|
||||||
},
|
},
|
||||||
"Bing translator": {
|
"Bing translator": {
|
||||||
"version": 1,
|
"version": 2,
|
||||||
"url": "https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master/translators/bing.js",
|
"url": "https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master/translators/bing.js",
|
||||||
"path": "translators/bing.js"
|
"path": "translators/bing.js"
|
||||||
},
|
},
|
||||||
@ -24,7 +24,7 @@
|
|||||||
"path": "translators/google.js"
|
"path": "translators/google.js"
|
||||||
},
|
},
|
||||||
"Yandex translator": {
|
"Yandex translator": {
|
||||||
"version": 1,
|
"version": 2,
|
||||||
"url": "https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master/translators/yandex.js",
|
"url": "https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master/translators/yandex.js",
|
||||||
"path": "translators/yandex.js"
|
"path": "translators/yandex.js"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user