From 116ff7f81a6227f0ecca6159cf498244c65910b1 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 4 Sep 2022 17:51:33 +0200 Subject: [PATCH] Refactoring --- app/src/main/java/eu/faircode/email/LanguageTool.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/LanguageTool.java b/app/src/main/java/eu/faircode/email/LanguageTool.java index 1c6bd8ea24..5181d376ae 100644 --- a/app/src/main/java/eu/faircode/email/LanguageTool.java +++ b/app/src/main/java/eu/faircode/email/LanguageTool.java @@ -55,14 +55,15 @@ public class LanguageTool { "text=" + URLEncoder.encode(text.toString(), StandardCharsets.UTF_8.name()) + "&language=auto"; - // curl -X GET --header 'Accept: application/json' 'https://api.languagetool.org/v2/languages - String code = null; + // curl -X GET --header 'Accept: application/json' 'https://api.languagetool.org/v2/languages' JSONArray jlanguages; - Locale locale = Locale.getDefault(); try (InputStream is = context.getAssets().open("lt.json")) { String json = Helper.readStream(is); jlanguages = new JSONArray(json); } + + String code = null; + Locale locale = Locale.getDefault(); for (int i = 0; i < jlanguages.length(); i++) { JSONObject jlanguage = jlanguages.getJSONObject(i); String c = jlanguage.optString("longCode");