feat(ui): translations for AccessDeniedException.

This commit is contained in:
huanghongxun 2021-10-13 13:47:59 +08:00
parent c9a73a366d
commit ef4f2ed791
4 changed files with 6 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import org.jackhuang.hmcl.util.io.ResponseCodeException;
import java.io.FileNotFoundException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.nio.file.AccessDeniedException;
import java.util.Arrays;
import java.util.Map;
import java.util.Optional;
@ -150,6 +151,8 @@ public final class DownloadProviders {
}
} else if (exception.getCause() instanceof FileNotFoundException) {
return i18n("download.code.404", url);
} else if (exception.getCause() instanceof AccessDeniedException) {
return i18n("install.failed.downloading.access_denied", url, ((AccessDeniedException) exception.getCause()).getFile());
} else {
return i18n("install.failed.downloading.detail", url) + "\n" + StringUtils.getStackTrace(exception.getCause());
}

View File

@ -392,6 +392,7 @@ install.change_version=Change version
install.change_version.confirm=Are you sure you want to update %s from verison %s to %s?
install.failed=Version failed to install
install.failed.downloading=Failed to install due to some files not downloaded successfully
install.failed.downloading.access_denied=Failed to download file: %1$s. Because it's denied by operating system to access file %2$s. Maybe we don't have permission to access this file, or this file has already been opened by other program. You can try to close related program, or restart your computer.
install.failed.downloading.detail=Failed to download file: %s
install.failed.downloading.timeout=Timed out while downloading the file: %s
install.failed.install_online=Unable to recognize the provided installer file. If you are installing a mod, go to "Mods" page.

View File

@ -392,6 +392,7 @@ install.change_version=變更版本
install.change_version.confirm=你確定要 %s 從 %s 更新到 %s 嗎?
install.failed=安裝失敗
install.failed.downloading=安裝失敗,部分檔案未能完成下載
install.failed.downloading.access_denied=未能下載文件:%1$s。因為無法訪問文件 %2$sHMCL 沒有對該文件的訪問權限,或者該文件被其他程序打開。你可以嘗試關閉相關程序,或者重啟電腦再試。
install.failed.downloading.detail=未能下載檔案: %s
install.failed.downloading.timeout=下載逾時: %s
install.failed.install_online=無法識別要安裝的軟體。如果你要安裝 Mod你需要在模組管理頁面安裝模組。

View File

@ -392,6 +392,7 @@ install.change_version=更换版本
install.change_version.confirm=你确定要将 %s 从 %s 更新到 %s 吗?
install.failed=安装失败
install.failed.downloading=安装失败,部分文件未能完成下载
install.failed.downloading.access_denied=未能下载文件:%1$s。因为无法访问文件 %2$sHMCL 没有对该文件的访问权限,或者该文件被其他程序打开。你可以尝试关闭相关程序,或者重启电脑再试。
install.failed.downloading.detail=未能下载文件:%s
install.failed.downloading.timeout=下载超时:%s
install.failed.install_online=无法识别要安装的软件。如果你要安装 Mod你需要在模组管理页面安装模组。