From f4222f0280c2f289227c9f24ee71f3c989afda17 Mon Sep 17 00:00:00 2001 From: MiaoMint <1981324730@qq.com> Date: Wed, 23 Aug 2023 17:27:47 +0800 Subject: [PATCH] refactor: i18n fallback en --- assets/i18n/en.json | 12 ++++++++++++ assets/i18n/zh.json | 11 ++--------- lib/utils/i18n.dart | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/assets/i18n/en.json b/assets/i18n/en.json index e24e26e8..b20e604c 100644 --- a/assets/i18n/en.json +++ b/assets/i18n/en.json @@ -1,4 +1,14 @@ { + "languages": { + "be": "Беларуская", + "en": "English", + "ja": "日本語", + "ru": "Русский", + "ryu": "うちなーぐち", + "uk": "Українська", + "zh": "中文" + }, + "common": { "home": "Home", "search": "Search", @@ -71,6 +81,8 @@ "theme-system": "System", "theme-light": "Light", "theme-dark": "Dark", + "nsfw": "NSFW", + "nsfw-subtitle": "Show NSFW content", "language-subtitle": "Change the language of the software", "extension-log": "Extension Log Window", "extension-log-subtitle": "Used for debugging extensions", diff --git a/assets/i18n/zh.json b/assets/i18n/zh.json index c4248283..65ee4233 100644 --- a/assets/i18n/zh.json +++ b/assets/i18n/zh.json @@ -1,13 +1,4 @@ { - "languages": { - "be": "Беларуская", - "en": "English", - "ja": "日本語", - "ru": "Русский", - "ryu": "うちなーぐち", - "uk": "Українська", - "zh": "中文" - }, "common": { "home": "首页", @@ -81,6 +72,8 @@ "theme-system": "跟随系统", "theme-light": "浅色", "theme-dark": "深色", + "nsfw": "NSFW", + "nsfw-subtitle": "显示 NSFW 内容", "language-subtitle": "选择软件的语言", "extension-log": "扩展日志窗口", "extension-log-subtitle": "用于调试扩展", diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index 9160fd08..b14e9792 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -14,7 +14,7 @@ class I18nUtils { static final flutterI18nDelegate = FlutterI18nDelegate( translationLoader: FileTranslationLoader( useCountryCode: false, - fallbackFile: 'zh', + fallbackFile: 'en', basePath: 'assets/i18n', forcedLocale: Locale(MiruStorage.getSetting(SettingKey.language)), decodeStrategies: [JsonDecodeStrategy()],