1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-02-21 21:57:19 +00:00

Added comments

This commit is contained in:
M66B 2021-07-28 13:01:40 +02:00
parent 142366b738
commit 3fef005543

View file

@ -187,6 +187,7 @@ public class DeepL {
} }
public static Translation translate(String text, String target, Context context) throws IOException, JSONException { public static Translation translate(String text, String target, Context context) throws IOException, JSONException {
// https://www.deepl.com/docs-api/translating-text/request/
String request = String request =
"text=" + URLEncoder.encode(text, StandardCharsets.UTF_8.name()) + "text=" + URLEncoder.encode(text, StandardCharsets.UTF_8.name()) +
"&target_lang=" + URLEncoder.encode(target, StandardCharsets.UTF_8.name()); "&target_lang=" + URLEncoder.encode(target, StandardCharsets.UTF_8.name());
@ -242,6 +243,7 @@ public class DeepL {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String key = prefs.getString("deepl_key", null); String key = prefs.getString("deepl_key", null);
// https://www.deepl.com/docs-api/other-functions/monitoring-usage/
URL url = new URL(getBaseUri(context) + "usage?auth_key=" + key); URL url = new URL(getBaseUri(context) + "usage?auth_key=" + key);
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setReadTimeout(DEEPL_TIMEOUT * 1000); connection.setReadTimeout(DEEPL_TIMEOUT * 1000);