diff --git a/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt b/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt index 4ecda189..a41aac4b 100644 --- a/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt +++ b/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt @@ -35,6 +35,7 @@ import com.wireguard.android.BuildConfig import com.wireguard.android.R import com.wireguard.android.databinding.LogViewerActivityBinding import com.wireguard.android.util.DownloadsFileSaver +import com.wireguard.android.util.ErrorMessages import com.wireguard.android.widget.EdgeToEdge.setUpFAB import com.wireguard.android.widget.EdgeToEdge.setUpRoot import com.wireguard.android.widget.EdgeToEdge.setUpScrollingContent @@ -169,17 +170,25 @@ class LogViewerActivity : AppCompatActivity() { withContext(Dispatchers.Main) { saveButton?.isEnabled = false withContext(Dispatchers.IO) { - val outputFile = DownloadsFileSaver.save(context, "wireguard-log.txt", "text/plain", true) - outputFile.outputStream.use { - it.write(rawLogLines.toString().toByteArray(Charsets.UTF_8)) + var exception: Throwable? = null + var outputFile: DownloadsFileSaver.DownloadsFile? = null + try { + outputFile = DownloadsFileSaver.save(context, "wireguard-log.txt", "text/plain", true) + outputFile.outputStream.use { + it.write(rawLogLines.toString().toByteArray(Charsets.UTF_8)) + } + } catch (e: Throwable) { + outputFile?.delete() + exception = e } withContext(Dispatchers.Main) { + saveButton?.isEnabled = true Snackbar.make(findViewById(android.R.id.content), - getString(R.string.log_export_success, outputFile.fileName), - Snackbar.LENGTH_SHORT) + if (exception == null) getString(R.string.log_export_success, outputFile?.fileName) + else getString(R.string.log_export_error, ErrorMessages.get(exception)), + if (exception == null) Snackbar.LENGTH_SHORT else Snackbar.LENGTH_LONG) .setAnchorView(binding.shareFab) .show() - saveButton?.isEnabled = true } } } diff --git a/ui/src/main/res/values-hi/strings.xml b/ui/src/main/res/values-hi/strings.xml index bda0cbb2..a3264b15 100644 --- a/ui/src/main/res/values-hi/strings.xml +++ b/ui/src/main/res/values-hi/strings.xml @@ -88,6 +88,7 @@ : वायरगार्ड कीज 32 बाइट होनी चाहिए : वायरगार्ड हेक्स कीज़ 64 अक्षरों की होनी चाहिए (32 बाइट्स) पोर्ट सूने + लॉग निर्यात करने में असमर्थ: %s “%s” में सहेजा गया लॉग फ़ाइल निर्यात करें लॉगकैट चलाने में असमर्थ: diff --git a/ui/src/main/res/values-id/strings.xml b/ui/src/main/res/values-id/strings.xml index 3f0af404..3c097e6e 100644 --- a/ui/src/main/res/values-id/strings.xml +++ b/ui/src/main/res/values-id/strings.xml @@ -88,6 +88,7 @@ : Kunci WireGuard harus terdiri dari 32 bit : Kunci hex WireGuard Harus terdiri dari 64 karakter (32 bit) Isi port + Log tidak bisa diekspor: %s Simpan ke “%s” Ekspor file log Tidak bisa menjalankan logcat: diff --git a/ui/src/main/res/values-it/strings.xml b/ui/src/main/res/values-it/strings.xml index 2ab211e9..ba768a51 100644 --- a/ui/src/main/res/values-it/strings.xml +++ b/ui/src/main/res/values-it/strings.xml @@ -88,6 +88,7 @@ : le chiavi di WireGuard devono essere di 32 byte : le chiavi hex di WireGuard devono essere di 64 caratteri (32 byte) Porta in ascolto + Impossibile esportare il registro: %s Salvato in “%s” Esporta file registro Impossibile eseguire logcat: diff --git a/ui/src/main/res/values-ja/strings.xml b/ui/src/main/res/values-ja/strings.xml index 5d342d2d..87e2dc33 100644 --- a/ui/src/main/res/values-ja/strings.xml +++ b/ui/src/main/res/values-ja/strings.xml @@ -84,6 +84,7 @@ : WireGuard 鍵は32バイトでなければなりません : WireGuard hex 鍵は64文字(32バイト)でなければなりません Listen ポート + ログをエクスポートできません: %s “%s” に保存しました ログのエクスポート logcat を実行できません: diff --git a/ui/src/main/res/values-ru/strings.xml b/ui/src/main/res/values-ru/strings.xml index 51b39be1..92278235 100644 --- a/ui/src/main/res/values-ru/strings.xml +++ b/ui/src/main/res/values-ru/strings.xml @@ -93,6 +93,7 @@ : Ключи WireGuard должны быть 32 байта : HEX ключи WireGuard должны содержать 64 символа (32 байта) Порт + Не удалось экспортировать логи: %s Сохранено в “%s” Экспорт логов в файл Файл логов WireGuard Android diff --git a/ui/src/main/res/values-zh-rCN/strings.xml b/ui/src/main/res/values-zh-rCN/strings.xml index 4e3730f1..73db2f6e 100644 --- a/ui/src/main/res/values-zh-rCN/strings.xml +++ b/ui/src/main/res/values-zh-rCN/strings.xml @@ -82,6 +82,7 @@ :WireGuard 密钥大小必须为 32 字节 :WireGuard 的十六进制密钥长度必须为 64 个字符(32 字节) 监听端口 + 无法导出日志:%s 已保存至 “%s” 导出日志文件 无法运行 logcat: diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml index 64813dbe..9d855bda 100644 --- a/ui/src/main/res/values/strings.xml +++ b/ui/src/main/res/values/strings.xml @@ -26,9 +26,9 @@ Add peer Addresses - Allow remote control apps - External apps may toggle tunnels (advanced) External apps may not toggle tunnels (recommended) + External apps may toggle tunnels (advanced) + Allow remote control apps Allowed IPs WireGuard %1$s\'s %2$s @@ -57,18 +57,17 @@ Successfully saved configuration for “%s” Create WireGuard Tunnel Cannot create local binary directory + Cannot create file in downloads directory Create from scratch Import from file or archive Scan from QR code Cannot create output directory - Cannot create file in downloads directory Cannot create local temporary directory Create Tunnel Currently using light (day) theme Currently using dark (night) theme Use dark theme Delete - Toggle All DNS servers Edit Endpoint @@ -89,29 +88,35 @@ Import Tunnel from QR Code Imported “%s” Interface + Bad characters in key + Incorrect key length : WireGuard base64 keys must be 44 characters (32 bytes) : WireGuard keys must be 32 bytes : WireGuard hex keys must be 64 characters (32 bytes) Listen port + Unable to export log: %s + WireGuard Android Log File Saved to “%s” Export log file - WireGuard Android Log File + Save log + Logs may assist with debugging + View application log + Log Unable to run logcat: - Unable to determine kernel module version - No modules are available for your device + The experimental kernel module can improve performance + Enable kernel module backend + The slower userspace backend may improve stability + Disable kernel module backend + Something went wrong. Please try again The experimental kernel module can improve performance + No modules are available for your device Download and install kernel module Downloading and installing… - Something went wrong. Please try again - Enable kernel module backend - The experimental kernel module can improve performance - Disable kernel module backend - The slower userspace backend may improve stability - Success. The application will now restart… + Unable to determine kernel module version MTU - Allow multiple simultaneous tunnels - Multiple tunnels may be turned on simultaneously Turning on one tunnel will turn off others + Multiple tunnels may be turned on simultaneously + Allow multiple simultaneous tunnels Name Trying to bring up a tunnel with no config No configurations found @@ -131,8 +136,8 @@ Public key Public key Tip: generate with `qrencode -t ansiutf8 < tunnel.conf`. - Will bring up enabled tunnels at boot Will not bring up enabled tunnels at boot + Will bring up enabled tunnels at boot Restore on boot Save Select all @@ -141,6 +146,8 @@ Shell cannot read exit status Shell expected 4 markers, received %d Shell failed to start: %d + Success. The application will now restart… + Toggle All Error toggling WireGuard tunnel: %s wg and wg-quick are already installed Unable to install command-line tools (no root?) @@ -153,11 +160,11 @@ Installing wg and wg-quick Required tools unavailable Transfer - rx: %1$s, tx: %2$s %d B + %.2f GiB %.2f KiB %.2f MiB - %.2f GiB + rx: %1$s, tx: %2$s %.2f TiB Unable to create tun device Unable to configure tunnel (wg-quick returned %d) @@ -183,10 +190,4 @@ Saved to “%s” Zip file will be saved to downloads folder Export tunnels to zip file - Incorrect key length - Bad characters in key - Log - View application log - Logs may assist with debugging - Save log