This repository was archived by the owner on Jul 4, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -1890,6 +1890,11 @@ void QOnlineTranslator::buildLibreStateMachine()
18901890
18911891void QOnlineTranslator::buildLibreDetectStateMachine ()
18921892{
1893+ Q_ASSERT_X (
1894+ !m_libreUrl.isEmpty (),
1895+ " buildLibreDetectStateMachine" ,
1896+ " The engine requires a URL, but it was not specified" );
1897+
18931898 // States
18941899 auto *detectState = new QState (m_stateMachine);
18951900 auto *finalState = new QFinalState (m_stateMachine);
@@ -1918,6 +1923,11 @@ void QOnlineTranslator::buildLingvaStateMachine()
19181923
19191924void QOnlineTranslator::buildLingvaDetectStateMachine ()
19201925{
1926+ Q_ASSERT_X (
1927+ !m_lingvaUrl.isEmpty (),
1928+ " buildLingvaDetectStateMachine" ,
1929+ " The engine requires a URL, but it was not specified" );
1930+
19211931 // States
19221932 auto *detectState = new QState (m_stateMachine);
19231933 auto *finalState = new QFinalState (m_stateMachine);
Original file line number Diff line number Diff line change @@ -430,7 +430,8 @@ class QOnlineTranslator : public QObject
430430 /* *
431431 * @brief Set the URL engine
432432 *
433- * Affects only LibreTranslate and Lingva.
433+ * Only affects LibreTranslate and Lingva because these engines have multiple instances.
434+ * You need to call this function to specify the URL of an instance for them.
434435 *
435436 * @param engine engine
436437 * @param url engine url
@@ -622,11 +623,9 @@ private slots:
622623 QString m_errorString;
623624
624625 // Self-hosted engines settings
625- // LibreTranslate
626- QByteArray m_libreApiKey; // Doesn't require key for free instance
627- QString m_libreUrl = QStringLiteral(" https://translate.argosopentech.com" ); // One of the free instance
628- // Lingva
629- QString m_lingvaUrl = QStringLiteral(" https://lingva.ml" );
626+ QByteArray m_libreApiKey; // Can be empty, since free instances ignores api_key param
627+ QString m_libreUrl;
628+ QString m_lingvaUrl;
630629
631630 QMap<QString, QVector<QOption>> m_translationOptions;
632631 QMap<QString, QVector<QExample>> m_examples;
You can’t perform that action at this time.
0 commit comments