diff --git a/FrostRender/src/main/java/cn/powernukkitx/fd/render/render/step/MultiLangLinkCollector.java b/FrostRender/src/main/java/cn/powernukkitx/fd/render/render/step/MultiLangLinkCollector.java index 7c44200..61314b7 100644 --- a/FrostRender/src/main/java/cn/powernukkitx/fd/render/render/step/MultiLangLinkCollector.java +++ b/FrostRender/src/main/java/cn/powernukkitx/fd/render/render/step/MultiLangLinkCollector.java @@ -37,13 +37,16 @@ public void render(@NotNull Renderer renderer, @NotNull Workflow workflow, @NotN var linkObj = new JsonObject(); for (var lang : languages) { var langStr = lang.getAsString(); - var link = regexp.matcher(page.getOutputPath().toString()).replaceAll(langStr); - if (link != null) { - var tmp = Path.of(link); - if (Files.exists(Shared.OUTPUT_DIR.get().resolve(Shared.WORKING_DIR.get().relativize(tmp)))) { - linkObj.addProperty(langStr, page.getOutputPath().getParent().relativize(tmp).toString().replace('\\', '/')); + var outputLink = regexp.matcher(page.getOutputPath().toString()).replaceAll(langStr); + var sourceLink = regexp.matcher(page.getPath().toString()).replaceAll(langStr); + if (outputLink != null) { + var outputPath = Path.of(outputLink); + var sourcePath = Path.of(sourceLink); + if (Files.exists(sourcePath)) { + linkObj.addProperty(langStr, page.getOutputPath().getParent().relativize(outputPath).toString().replace('\\', '/')); } else { linkObj.add(langStr, JsonNull.INSTANCE); + Logger.of(MultiLangLinkCollector.class).info("no-language-doc-found", langStr, page.getPath()); } } } diff --git a/FrostRender/src/main/resources/fr-language/en-us.json b/FrostRender/src/main/resources/fr-language/en-us.json index 64e3b05..7897805 100644 --- a/FrostRender/src/main/resources/fr-language/en-us.json +++ b/FrostRender/src/main/resources/fr-language/en-us.json @@ -26,8 +26,12 @@ "template-not-specify": "The file {} has not applied a template. Catalogue wont be generated.", "failed-to-parse-image": "Unable to parse image {}, reason: {}", "unsupported-image-format": "The image format used by {} is not supported temporarily.", + "no-language-doc-found": "{} version of doc {} cannot be found.", "config-file": "config file", "template-file": "template file", - "content-file": "content file" + "content-file": "content file", + + "zh-cn": "Simplified Chinese", + "en-us": "English" } \ No newline at end of file diff --git a/FrostRender/src/main/resources/fr-language/zh-cn.json b/FrostRender/src/main/resources/fr-language/zh-cn.json index c2d07c1..6c951e9 100644 --- a/FrostRender/src/main/resources/fr-language/zh-cn.json +++ b/FrostRender/src/main/resources/fr-language/zh-cn.json @@ -27,8 +27,12 @@ "template-not-specify": "文件 {} 尚未应用模板,无法注入目录。", "failed-to-parse-image": "无法解析图像 {},原因:{}", "unsupported-image-format": "暂不支持 {} 所用的图像格式。", + "no-language-doc-found": "文档 {1} 的 {} 版本没有找到。", "config-file": "配置文件", "template-file": "模板文件", - "content-file": "内容文件" + "content-file": "内容文件", + + "zh-cn": "简体中文", + "en-us": "英语" } \ No newline at end of file