mirror of https://github.com/M66B/FairEmail.git
Check internet connection on translate
This commit is contained in:
parent
401ded742f
commit
c6319a0974
|
@ -197,6 +197,9 @@ public class DeepL {
|
|||
}
|
||||
|
||||
public static Translation translate(String text, String target, boolean formality, Context context) throws IOException, JSONException {
|
||||
if (!ConnectionHelper.getNetworkState(context).isConnected())
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_internet));
|
||||
|
||||
// https://www.deepl.com/docs-api/translating-text/request/
|
||||
String request =
|
||||
"text=" + URLEncoder.encode(text, StandardCharsets.UTF_8.name()) +
|
||||
|
|
Loading…
Reference in New Issue