From 33b791f2b01f17a68fa21b8fd5e2a8f43552679d Mon Sep 17 00:00:00 2001 From: Glavo Date: Wed, 12 Feb 2025 19:37:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=A5=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=A0=BC=E5=BC=8F=20(#3610)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "improv(i18n): refine time formats on ui (#3608)" This reverts commit 741f65d37ccbac093fcc49c98e1067b4afe98834. * update --- .../java/org/jackhuang/hmcl/ui/versions/DownloadPage.java | 7 +------ HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/I18n.java | 3 +-- .../main/java/org/jackhuang/hmcl/util/i18n/Locales.java | 2 +- HMCL/src/main/resources/assets/lang/I18N.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_es.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_ja.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_ru.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_zh.properties | 1 + HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties | 1 + 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java index 849e6a1dc..d5191e6fb 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java @@ -55,9 +55,6 @@ import org.jackhuang.hmcl.util.versioning.GameVersionNumber; import org.jetbrains.annotations.Nullable; import java.io.File; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.time.format.FormatStyle; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -388,7 +385,7 @@ public class DownloadPage extends Control implements DecoratorPage { TwoLineListItem content = new TwoLineListItem(); HBox.setHgrow(content, Priority.ALWAYS); content.setTitle(dataItem.getName()); - content.setSubtitle(FORMATTER.format(dataItem.getDatePublished())); + content.setSubtitle(I18n.formatDateTime(dataItem.getDatePublished())); switch (dataItem.getVersionType()) { case Alpha: @@ -528,8 +525,6 @@ public class DownloadPage extends Control implements DecoratorPage { } } - private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withLocale(Locale.getDefault()).withZone(ZoneId.systemDefault()); - public interface DownloadCallback { void download(Profile profile, @Nullable String version, RemoteMod.Version file); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/I18n.java b/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/I18n.java index dd6c9784f..a36c66c26 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/I18n.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/I18n.java @@ -22,7 +22,6 @@ import org.jackhuang.hmcl.util.i18n.Locales.SupportedLocale; import java.time.Instant; import java.time.ZoneId; import java.time.format.DateTimeFormatter; -import java.time.format.FormatStyle; import java.util.*; import static org.jackhuang.hmcl.util.logging.Logger.LOG; @@ -78,7 +77,7 @@ public final class I18n { public static String formatDateTime(Instant instant) { DateTimeFormatter formatter = dateTimeFormatter; if (formatter == null) { - formatter = dateTimeFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withLocale(Locale.getDefault()).withZone(ZoneId.systemDefault()); + formatter = dateTimeFormatter = DateTimeFormatter.ofPattern(getResourceBundle().getString("world.time")).withZone(ZoneId.systemDefault()); } return formatter.format(instant); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/Locales.java b/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/Locales.java index 18ef483a7..1ce7d404f 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/Locales.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/Locales.java @@ -37,7 +37,7 @@ public final class Locales { /** * English */ - public static final SupportedLocale EN = new SupportedLocale(Locale.US); + public static final SupportedLocale EN = new SupportedLocale(Locale.ENGLISH); /** * Spanish diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 20b212e96..67897da82 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -1088,6 +1088,7 @@ world.name=World Name world.name.enter=Enter the world name world.reveal=Reveal in Explorer world.show_all=Show All +world.time=h\:mm\:ss a, EEE, MMM d yyyy profile=Game Directories profile.already_exists=This name already exists. Please use a different name. diff --git a/HMCL/src/main/resources/assets/lang/I18N_es.properties b/HMCL/src/main/resources/assets/lang/I18N_es.properties index b312ea811..215ee1099 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_es.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_es.properties @@ -1035,6 +1035,7 @@ world.name=Nombre del mundo world.name.enter=Introducir el nombre del mundo world.reveal=Abrir en el Explorador world.show_all=Mostrar todo +world.time=EEE, MMM d, yyyy HH\:mm\:ss profile=Directorios del juego profile.already_exists=Este nombre ya existe, por favor, utilice un nombre diferente. diff --git a/HMCL/src/main/resources/assets/lang/I18N_ja.properties b/HMCL/src/main/resources/assets/lang/I18N_ja.properties index 38db05572..649759483 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ja.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ja.properties @@ -717,6 +717,7 @@ world.name=マップ名 world.name.enter=マップ名を入力してください world.reveal=フォルダを表示 world.show_all=すべて表示 +world.time=EEE、MMM d、yyyy HH:mm:ss profile=ゲームディレクトリ profile.already_exists=この名前はすでに存在します。別の名前を使用してください。 diff --git a/HMCL/src/main/resources/assets/lang/I18N_ru.properties b/HMCL/src/main/resources/assets/lang/I18N_ru.properties index 7dd15d880..1937c901a 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ru.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ru.properties @@ -776,6 +776,7 @@ world.name=Название мира world.name.enter=Введите название мира world.reveal=Показать в проводнике world.show_all=Показать все +world.time=EEE, MMM d, yyyy HH\:mm\:ss profile=Папки с играми profile.already_exists=Имя уже существует, используйте другое имя. diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index 9f122ab7e..c57e83711 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -892,6 +892,7 @@ world.name=世界名稱 world.name.enter=輸入世界名稱 world.reveal=開啟目錄 world.show_all=全部顯示 +world.time=yyyy 年 MM 月 dd 日 HH:mm:ss profile=遊戲目錄 profile.already_exists=該名稱已存在 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index 3af24a2f6..cd9f8b97c 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -903,6 +903,7 @@ world.name=世界名称 world.name.enter=输入世界名称 world.reveal=打开文件夹 world.show_all=显示全部 +world.time=yyyy 年 MM 月 dd 日 HH:mm:ss profile=游戏文件夹 profile.already_exists=该名称已存在