diff --git a/app/src/main/java/eu/faircode/email/DeepL.java b/app/src/main/java/eu/faircode/email/DeepL.java
index 1836f708b1..5a087be277 100644
--- a/app/src/main/java/eu/faircode/email/DeepL.java
+++ b/app/src/main/java/eu/faircode/email/DeepL.java
@@ -127,7 +127,6 @@ public class DeepL {
}
}
-
private static String getBaseUri(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String domain = prefs.getString("deepl_domain", "api-free.deepl.com");
diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java
index 7776a6763a..06847acb52 100644
--- a/app/src/main/java/eu/faircode/email/FragmentCompose.java
+++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java
@@ -100,7 +100,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.SwitchCompat;
import androidx.constraintlayout.widget.Group;
@@ -6784,7 +6783,8 @@ public class FragmentCompose extends FragmentBase {
tvUsage.setVisibility(View.GONE);
- if (!TextUtils.isEmpty(key)) {
+ if (!TextUtils.isEmpty(key) &&
+ (domain == null || domain.equals("api-free.deepl.com"))) {
Bundle args = new Bundle();
args.putString("key", key);
@@ -6796,9 +6796,10 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onExecuted(Bundle args, Integer[] usage) {
- tvUsage.setText(
- Helper.humanReadableByteCount(usage[0]) + "/" +
- Helper.humanReadableByteCount(usage[1]));
+ tvUsage.setText(getString(R.string.title_translate_usage,
+ Helper.humanReadableByteCount(usage[0]),
+ Helper.humanReadableByteCount(usage[1]),
+ Math.round(100f * usage[0] / usage[1])));
tvUsage.setVisibility(View.VISIBLE);
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e68d498544..c838432a3d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1112,6 +1112,7 @@
Enter key
Translating …
Use a small font for the source text
+ Usage: %1$s / %2$s (%3$d %%)
Edit as plain text
Edit as reformatted text
Select public key