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