mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-26 19:05:23 +01:00
Improved DeepL current language selection
This commit is contained in:
2
FAQ.md
2
FAQ.md
@@ -3708,11 +3708,13 @@ Unfortunately, it is not possible to hide messages on the email server too.
|
||||
<a name="faq167"></a>
|
||||
**(167) How can I use DeepL?**
|
||||
|
||||
1. Check if [DeepL](https://www.deepl.com/) supports your language
|
||||
1. Enable DeepL support in the miscellaneous settings
|
||||
1. [Subscribe to](https://www.deepl.com/pro#developer) the DeepL API Free or Pro plan (credit card required)
|
||||
1. [Copy](https://www.deepl.com/pro-account/plan) the authentication key
|
||||
1. In the message composer tap on the faint translate button (文A), select *Configure* and paste the key
|
||||
|
||||
|
||||
You might want to read the [privacy policy](https://www.deepl.com/privacy/) of DeepL.
|
||||
|
||||
This feature requires an internet connection and is not available in the Play store version.
|
||||
|
||||
@@ -140,11 +140,25 @@ public class DeepL {
|
||||
ensureLanguages(context);
|
||||
|
||||
Locale locale = Locale.getDefault();
|
||||
String tag = locale.toLanguageTag(); // en-US
|
||||
String lang = locale.getLanguage(); // en
|
||||
|
||||
if ("en".equalsIgnoreCase(lang))
|
||||
if ("EN-GB".equalsIgnoreCase(tag) || "EN-US".equalsIgnoreCase(tag))
|
||||
lang = tag;
|
||||
else
|
||||
lang = "EN-US";
|
||||
|
||||
if ("pt".equalsIgnoreCase(lang))
|
||||
if ("PT-BR".equalsIgnoreCase(tag) || "PT-PT".equalsIgnoreCase(tag))
|
||||
lang = tag;
|
||||
else
|
||||
lang = "PT-PT";
|
||||
|
||||
for (int i = 0; i < jlanguages.length(); i++) {
|
||||
JSONObject jlanguage = jlanguages.getJSONObject(i);
|
||||
String language = jlanguage.getString("language");
|
||||
if (language.equalsIgnoreCase(locale.toLanguageTag()) ||
|
||||
language.equalsIgnoreCase(locale.getLanguage())) {
|
||||
if (language.equalsIgnoreCase(lang)) {
|
||||
return language;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user