Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions Easydict.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
A73120261023000000000001 /* LocalizationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73120261023000000000002 /* LocalizationTests.swift */; };
02DEDC04202604300000007E /* MarkdownRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DEDC042026043000000002 /* MarkdownRenderer.swift */; };
02DEDC04202604300000008E /* MarkdownLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DEDC042026043000000003 /* MarkdownLabel.swift */; };
02DEDC04202604300000009E /* MarkdownToggleButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DEDC042026043000000004 /* MarkdownToggleButton.swift */; };
Expand Down Expand Up @@ -521,6 +522,8 @@
6808374D0730B5F9ADF6DD84 /* CodexManagedAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F6403A348529CBE1CFB24A1 /* CodexManagedAccountView.swift */; };
6A8C988E2BAC88B500DB835A /* LanguageState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A8C988C2BAC88B500DB835A /* LanguageState.swift */; };
6A8C988F2BAC88B500DB835A /* I18nHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A8C988D2BAC88B500DB835A /* I18nHelper.swift */; };
A73120261025000000000001 /* I18nHelper+Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73120261025000000000002 /* I18nHelper+Layout.swift */; };
A73120261025000000000003 /* InterfaceLanguageModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73120261025000000000004 /* InterfaceLanguageModifier.swift */; };
6A8C98952BAE841600DB835A /* LocalizedBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A8C98942BAE841600DB835A /* LocalizedBundle.swift */; };
6ADED1552BAE8809004A15BE /* NSBundle+Localization.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ADED1542BAE8809004A15BE /* NSBundle+Localization.m */; };
6BF322BF19CC4C61816B34F9 /* ClaudeResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C3F84B513D845C38F346217 /* ClaudeResponse.swift */; };
Expand Down Expand Up @@ -687,6 +690,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
A73120261023000000000002 /* LocalizationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizationTests.swift; sourceTree = "<group>"; };
003F53EF2A8C452998524A99 /* UtilityFunctionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilityFunctionsTests.swift; sourceTree = "<group>"; };
02DEDC042026043000000002 /* MarkdownRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkdownRenderer.swift; sourceTree = "<group>"; };
02DEDC042026043000000003 /* MarkdownLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkdownLabel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1308,6 +1312,8 @@
63D2A8E02F1C4B2E8C9A7101 /* MDictMetadataCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MDictMetadataCache.swift; sourceTree = "<group>"; };
6A8C988C2BAC88B500DB835A /* LanguageState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LanguageState.swift; sourceTree = "<group>"; };
6A8C988D2BAC88B500DB835A /* I18nHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = I18nHelper.swift; sourceTree = "<group>"; };
A73120261025000000000002 /* I18nHelper+Layout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "I18nHelper+Layout.swift"; sourceTree = "<group>"; };
A73120261025000000000004 /* InterfaceLanguageModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceLanguageModifier.swift; sourceTree = "<group>"; };
6A8C98942BAE841600DB835A /* LocalizedBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizedBundle.swift; sourceTree = "<group>"; };
6ADED1542BAE8809004A15BE /* NSBundle+Localization.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+Localization.m"; sourceTree = "<group>"; };
6BFA978362272A43BC0169C0 /* CodexRuntimeDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodexRuntimeDescriptor.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1494,6 +1500,14 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
A73120261023000000000003 /* Localization */ = {
isa = PBXGroup;
children = (
A73120261023000000000002 /* LocalizationTests.swift */,
);
path = Localization;
sourceTree = "<group>";
};
02DEDC042026043000000001 /* Markdown */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3528,6 +3542,8 @@
isa = PBXGroup;
children = (
6A8C988D2BAC88B500DB835A /* I18nHelper.swift */,
A73120261025000000000002 /* I18nHelper+Layout.swift */,
A73120261025000000000004 /* InterfaceLanguageModifier.swift */,
6A8C988C2BAC88B500DB835A /* LanguageState.swift */,
6A8C98942BAE841600DB835A /* LocalizedBundle.swift */,
6ADED1542BAE8809004A15BE /* NSBundle+Localization.m */,
Expand Down Expand Up @@ -3665,6 +3681,7 @@
BE5912DE778CDCD8495CA4E5 /* Feature */ = {
isa = PBXGroup;
children = (
A73120261023000000000003 /* Localization */,
A12760012026090500000003 /* Query */,
02DEDC0420260430000000C1 /* Markdown */,
030732CB2F24862A0001382A /* OCR */,
Expand Down Expand Up @@ -4073,6 +4090,7 @@
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
ur,
en,
Base,
es,
Expand Down Expand Up @@ -4422,6 +4440,7 @@
03A8846E2F12000100D5C0DE /* TaskTimeoutTests.swift in Sources */,
A1D1807E2F8D100100B1C0D1 /* ThrottleGateTests.swift in Sources */,
B95E8E65988E4351BF03462E /* UtilityFunctionsTests.swift in Sources */,
A73120261023000000000001 /* LocalizationTests.swift in Sources */,
73960B6BE1AB4186BA1377CF /* TestSuites.swift in Sources */,
03FDAE962E1A8A290029369E /* RegexTests.swift in Sources */,
031153412EDB0BA20083521F /* StringCommentHandlingTests.swift in Sources */,
Expand Down Expand Up @@ -4814,6 +4833,8 @@
033C6DCB2ED9E2E500AC39FC /* NiuTransTranslateResponse.swift in Sources */,
03D043522928935300E7559E /* EZMainQueryWindow.m in Sources */,
6A8C988F2BAC88B500DB835A /* I18nHelper.swift in Sources */,
A73120261025000000000001 /* I18nHelper+Layout.swift in Sources */,
A73120261025000000000003 /* InterfaceLanguageModifier.swift in Sources */,
03A9BE952E70631B0013E645 /* SystemUtility+Selection.swift in Sources */,
03D5C4CC2DA21EAD0054D0D4 /* MetadataExtractor.swift in Sources */,
03F2F1A62E54D70500FF71E3 /* OCRWindow.swift in Sources */,
Expand Down Expand Up @@ -4963,14 +4984,18 @@
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/Easydict/objc/ViewController/View/EZQueryMenuTextView",
);
MACOSX_DEPLOYMENT_TARGET = 14.1;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.izual.EasydictSwiftTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Easydict/objc/ViewController/View/TextView/EZTextView.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Easydict-debug.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Easydict-debug";
Expand All @@ -4992,13 +5017,17 @@
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/Easydict/objc/ViewController/View/EZQueryMenuTextView",
);
MACOSX_DEPLOYMENT_TARGET = 14.1;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.izual.EasydictSwiftTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Easydict/objc/ViewController/View/TextView/EZTextView.h";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Easydict-debug.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Easydict-debug";
};
Expand Down
19 changes: 17 additions & 2 deletions Easydict/App/EasydictApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct EasydictApp: App {
MenuBarExtra(isInserted: $hideMenuBar.toggledValue) {
MenuItemView()
.environmentObject(languageState)
.environment(\.locale, .init(identifier: I18nHelper.shared.localizeCode))
.interfaceLanguage()
} label: {
Label {
Text("Easydict")
Expand Down Expand Up @@ -103,7 +103,7 @@ struct EasydictApp: App {
Settings {
SettingView()
.environmentObject(languageState)
.environment(\.locale, .init(identifier: I18nHelper.shared.localizeCode))
.interfaceLanguage()
Comment thread
tisfeng marked this conversation as resolved.
Resolved
}
}

Expand All @@ -126,6 +126,13 @@ struct EasydictApp: App {
performTerminationTasks()
}
},
NotificationCenter.default.publisher(for: .languagePreferenceChanged)
.receive(on: DispatchQueue.main)
.sink { _ in
MainActor.assumeIsolated {
updateMainMenuDirection()
}
},
]

@Environment(\.openSettingsLegacy) private var openSettingsLegacy
Expand All @@ -144,9 +151,17 @@ struct EasydictApp: App {

@MainActor
private static func performPostLaunchTasks() {
updateMainMenuDirection()
GitHubCopilotModelStore.shared.startAutomaticRefresh()
}

@MainActor
private static func updateMainMenuDirection() {
if let menu = NSApp.mainMenu {
I18nHelper.shared.applyInterfaceLayoutDirection(to: menu)
}
}

/// Persist queued writes synchronously; an asynchronous task may not run before exit.
@MainActor
private static func performTerminationTasks() {
Expand Down
24 changes: 24 additions & 0 deletions Easydict/App/InfoPlist.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
"value" : "Easydict"
}
},
"ur" : {
"stringUnit" : {
"state" : "translated",
"value" : "Easydict"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
Expand Down Expand Up @@ -65,6 +71,12 @@
"value" : "Easydict"
}
},
"ur" : {
"stringUnit" : {
"state" : "translated",
"value" : "Easydict"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
Expand Down Expand Up @@ -107,6 +119,12 @@
"value" : "Easydict vyžaduje povolenie na vykonanie AppleScriptu."
}
},
"ur" : {
"stringUnit" : {
"state" : "translated",
"value" : "Easydict کو AppleScript چلانے کے لیے اجازت درکار ہے۔"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
Expand Down Expand Up @@ -149,6 +167,12 @@
"value" : "Autorské práva © 2023-2025 tisfeng. Všetky práva vyhradené."
}
},
"ur" : {
"stringUnit" : {
"state" : "translated",
"value" : "Copyright © 2023-2025 tisfeng. جملہ حقوق محفوظ ہیں۔"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
Expand Down
Loading
Loading