Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

add Simplified Chinese Localization #17

Merged
merged 4 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
52 changes: 27 additions & 25 deletions InjectGUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
381027E02C5F784F00348460 /* Extension+Scene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381027DF2C5F784F00348460 /* Extension+Scene.swift */; };
381027E22C5F7C4800348460 /* Extension+Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381027E12C5F7C4800348460 /* Extension+Font.swift */; };
381027E42C5F7E1100348460 /* Extension+URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381027E32C5F7E1100348460 /* Extension+URL.swift */; };
381027E72C5F816500348460 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 381027E92C5F816500348460 /* Localizable.strings */; };
387CEA792C5BD9C400E3A5AC /* AdminPrivilegeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387CEA782C5BD9C400E3A5AC /* AdminPrivilegeView.swift */; };
387CEA7B2C5DEF0600E3A5AC /* Extension+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387CEA7A2C5DEF0600E3A5AC /* Extension+String.swift */; };
38877A1D2C4A6F83009F5910 /* InjectGUIApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38877A1C2C4A6F83009F5910 /* InjectGUIApp.swift */; };
Expand All @@ -30,12 +29,14 @@
38AD95EA2C58E70E0032E79F /* Injector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AD95E92C58E70E0032E79F /* Injector.swift */; };
38AD95EE2C58F59C0032E79F /* StatusView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AD95ED2C58F59C0032E79F /* StatusView.swift */; };
38BC1F532C4B587A00C3B60E /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F522C4B587900C3B60E /* SidebarView.swift */; };
38BC1F552C4B622500C3B60E /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F542C4B622500C3B60E /* WelcomeView.swift */; };
38BC1F5A2C4B98A300C3B60E /* AppDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F592C4B98A300C3B60E /* AppDetailView.swift */; };
38BC1F5C2C4BB02200C3B60E /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */; };
38E944F22C5A761B00B252A3 /* Executor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E944F12C5A761B00B252A3 /* Executor.swift */; };
38E944F52C5A7F6A00B252A3 /* Cache in Frameworks */ = {isa = PBXBuildFile; productRef = 38E944F42C5A7F6A00B252A3 /* Cache */; };
38E944F72C5A85E200B252A3 /* Cache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E944F62C5A85E200B252A3 /* Cache.swift */; };
96BC7ED02C65C5E200149818 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 96BC7ECF2C65C5E200149818 /* Localizable.xcstrings */; };
96BC7ED62C65E7B100149818 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BC7ED52C65E7B100149818 /* AboutView.swift */; };
96BC7ED82C65E8C200149818 /* GeneralView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BC7ED72C65E8C200149818 /* GeneralView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -45,8 +46,6 @@
381027DF2C5F784F00348460 /* Extension+Scene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+Scene.swift"; sourceTree = "<group>"; };
381027E12C5F7C4800348460 /* Extension+Font.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+Font.swift"; sourceTree = "<group>"; };
381027E32C5F7E1100348460 /* Extension+URL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+URL.swift"; sourceTree = "<group>"; };
381027E82C5F816500348460 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
381027EA2C5F817400348460 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
387CEA782C5BD9C400E3A5AC /* AdminPrivilegeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminPrivilegeView.swift; sourceTree = "<group>"; };
387CEA7A2C5DEF0600E3A5AC /* Extension+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+String.swift"; sourceTree = "<group>"; };
38877A192C4A6F83009F5910 /* InjectGUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InjectGUI.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -65,11 +64,13 @@
38AD95E92C58E70E0032E79F /* Injector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Injector.swift; sourceTree = "<group>"; };
38AD95ED2C58F59C0032E79F /* StatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusView.swift; sourceTree = "<group>"; };
38BC1F522C4B587900C3B60E /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = "<group>"; };
38BC1F542C4B622500C3B60E /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; };
38BC1F592C4B98A300C3B60E /* AppDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDetailView.swift; sourceTree = "<group>"; };
38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
38E944F12C5A761B00B252A3 /* Executor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Executor.swift; sourceTree = "<group>"; };
38E944F62C5A85E200B252A3 /* Cache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cache.swift; sourceTree = "<group>"; };
96BC7ECF2C65C5E200149818 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; name = Localizable.xcstrings; path = InjectGUI/Localizables/Localizable.xcstrings; sourceTree = "<group>"; };
96BC7ED52C65E7B100149818 /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
96BC7ED72C65E8C200149818 /* GeneralView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -88,7 +89,7 @@
38877A102C4A6F83009F5910 = {
isa = PBXGroup;
children = (
381027E92C5F816500348460 /* Localizable.strings */,
96BC7ECF2C65C5E200149818 /* Localizable.xcstrings */,
38877A1B2C4A6F83009F5910 /* InjectGUI */,
38877A1A2C4A6F83009F5910 /* Products */,
);
Expand Down Expand Up @@ -143,12 +144,11 @@
38877A2C2C4A6FD7009F5910 /* View */ = {
isa = PBXGroup;
children = (
96BC7EDB2C65ED2800149818 /* Settings */,
38877A1E2C4A6F83009F5910 /* ContentView.swift */,
38BC1F522C4B587900C3B60E /* SidebarView.swift */,
38BC1F542C4B622500C3B60E /* WelcomeView.swift */,
38BC1F592C4B98A300C3B60E /* AppDetailView.swift */,
38AD95ED2C58F59C0032E79F /* StatusView.swift */,
38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */,
387CEA782C5BD9C400E3A5AC /* AdminPrivilegeView.swift */,
380D777C2C61EAB9005F3150 /* CheckForUpdatesView.swift */,
);
Expand Down Expand Up @@ -185,6 +185,16 @@
path = Util;
sourceTree = "<group>";
};
96BC7EDB2C65ED2800149818 /* Settings */ = {
isa = PBXGroup;
children = (
96BC7ED52C65E7B100149818 /* AboutView.swift */,
96BC7ED72C65E8C200149818 /* GeneralView.swift */,
38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */,
);
path = Settings;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -253,8 +263,8 @@
buildActionMask = 2147483647;
files = (
38877A252C4A6F87009F5910 /* Preview Assets.xcassets in Resources */,
96BC7ED02C65C5E200149818 /* Localizable.xcstrings in Resources */,
380D77842C620464005F3150 /* config.json in Resources */,
381027E72C5F816500348460 /* Localizable.strings in Resources */,
38877A212C4A6F87009F5910 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -278,11 +288,12 @@
38877A332C4A7222009F5910 /* PublishedStorage.swift in Sources */,
381027E02C5F784F00348460 /* Extension+Scene.swift in Sources */,
38E944F22C5A761B00B252A3 /* Executor.swift in Sources */,
38BC1F552C4B622500C3B60E /* WelcomeView.swift in Sources */,
38877A2E2C4A6FFA009F5910 /* InjectConfiguration.swift in Sources */,
38BC1F532C4B587A00C3B60E /* SidebarView.swift in Sources */,
38877A352C4A7254009F5910 /* ViewKit.swift in Sources */,
96BC7ED62C65E7B100149818 /* AboutView.swift in Sources */,
38877A3A2C4A730F009F5910 /* Constants.swift in Sources */,
96BC7ED82C65E8C200149818 /* GeneralView.swift in Sources */,
381027E42C5F7E1100348460 /* Extension+URL.swift in Sources */,
38BC1F5C2C4BB02200C3B60E /* SettingsView.swift in Sources */,
381027E22C5F7C4800348460 /* Extension+Font.swift in Sources */,
Expand All @@ -294,19 +305,6 @@
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
381027E92C5F816500348460 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
381027E82C5F816500348460 /* en */,
381027EA2C5F817400348460 /* zh-Hans */,
);
name = Localizable.strings;
path = InjectGUI/Localizables;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
38877A262C4A6F87009F5910 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down Expand Up @@ -359,10 +357,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
Expand Down Expand Up @@ -412,9 +412,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
Expand Down Expand Up @@ -445,7 +447,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 16.1;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.2.0;
PRODUCT_BUNDLE_IDENTIFIER = "dev.wibus-wee.InjectGUI";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -484,7 +486,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 16.1;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.2.0;
PRODUCT_BUNDLE_IDENTIFIER = "dev.wibus-wee.InjectGUI";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.8">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand All @@ -28,8 +28,6 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand Down
48 changes: 24 additions & 24 deletions InjectGUI/Backend/Injector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ extension InjectStage {
var description: String {
switch self {
case .start:
return "Start Injecting"
return String(localized: "Start Injecting")
case .copyExecutableFileAsBackup:
return "Copying Executable File as Backup"
return String(localized: "Copying Executable File as Backup")
case .checkPermissionAndRun:
return "Checking Permission and Run"
return String(localized: "Checking Permission and Run")
case .handleKeygen:
return "Handling Keygen"
return String(localized: "Handling Keygen")
case .handleDeepCodeSign:
return "Handling Deep Code Sign"
return String(localized: "Handling Deep Code Sign")
case .handleAutoHandleHelper:
return "Handling Auto Handle Helper"
return String(localized: "Handling Auto Handle Helper")
case .handleTccutil:
return "Handling Tccutil"
return String(localized: "Handling Tccutil")
case .handleExtraShell:
return "Handling Extra Shell"
return String(localized: "Handling Extra Shell")
case .handleInjectLibInject:
return "Handling Inject Lib Inject"
return String(localized: "Handling InjectLib Inject")
case .end:
return "Injecting Finished"
return String(localized: "Injecting Finished")
}
}
}
Expand Down Expand Up @@ -97,12 +97,12 @@ class Injector: ObservableObject {

if package.contains("com.setapp") {
let alert = NSAlert()
alert.messageText = "Please read the Setapp inject document first"
alert.informativeText = "It's important to read the Setapp inject document first before using the tool. Please"
alert.messageText = String(localized: "Please read the Setapp inject document first")
alert.informativeText = String(localized: "It's important to read the Setapp inject document first before using the tool. Please")
alert.alertStyle = .informational
alert.addButton(withTitle: "I have read the document")
alert.addButton(withTitle: "Read the document")
alert.addButton(withTitle: "Cancel")
alert.addButton(withTitle: String(localized: "I have read the document"))
alert.addButton(withTitle: String(localized: "Read the document"))
alert.addButton(withTitle: String(localized: "Cancel"))
let response = alert.runModal()
if response == .alertFirstButtonReturn {
// Continue
Expand All @@ -119,10 +119,10 @@ class Injector: ObservableObject {
}
if injectConfiguration.allToolsExist() == false {
let alert = NSAlert()
alert.messageText = "Inject Tools Not Found"
alert.informativeText = "Inject tools not found, it may be caused by network issues or the tools are not available. Please try again later."
alert.messageText = String(localized: "Inject Tools Not Found")
alert.informativeText = String(localized: "Inject tools not found, it may be caused by network issues or the tools are not available. Please try again later.")
alert.alertStyle = .warning
alert.addButton(withTitle: "OK")
alert.addButton(withTitle: String(localized: "OK"))
alert.runModal()
return
}
Expand Down Expand Up @@ -162,7 +162,7 @@ class Injector: ObservableObject {
.sink(receiveCompletion: { completion in
if case .failure(let error) = completion {
let alert = NSAlert()
alert.messageText = "Command Execution Error"
alert.messageText = String(localized: "Command Execution Error")

// Extracting the AppleScript error message
var errorMessage = error.localizedDescription
Expand All @@ -172,9 +172,9 @@ class Injector: ObservableObject {
}
}

alert.informativeText = "\(errorMessage) \n\nPlease check your application integrity and try again.\n\n(Stage: \(stage.description))"
alert.informativeText = String(localized: "\(errorMessage) \n\nPlease check your application integrity and try again.\n\n(Stage: \(stage.description))")
alert.alertStyle = .critical
alert.addButton(withTitle: "OK")
alert.addButton(withTitle: String(localized: "OK"))
alert.runModal()
self.updateInjectStage(stage: stage, message: "Error: \(errorMessage)", progress: 1, status: .error, error: InjectRunningError(error: errorMessage, stage: stage))
} else {
Expand Down Expand Up @@ -365,10 +365,10 @@ class Injector: ObservableObject {

if insert_dylib_URL == nil || QiuchenlyDylib_URL == nil {
let alert = NSAlert()
alert.messageText = "Inject Tools Path Not Found"
alert.informativeText = "This should not happen here, please report to the developer (Area: MainInject)"
alert.messageText = String(localized: "Inject Tools Path Not Found")
alert.informativeText = String(localized: "This should not happen here, please report to the developer (Area: MainInject)")
alert.alertStyle = .warning
alert.addButton(withTitle: "OK")
alert.addButton(withTitle: String(localized: "OK"))
return [("echo Inject Tools Path Not Found && exit 1", true)]
}

Expand Down
20 changes: 10 additions & 10 deletions InjectGUI/Extension/ViewKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ enum ViewKit {

static func useSheet(
title: String,
secondaryButton: String = "Cancel",
primaryButton: String = "OK",
secondaryButton: String = String(localized: "Cancel"),
primaryButton: String = String(localized: "OK"),
toolbar: (() -> (AnyView))? = nil,
content: @escaping () -> AnyView,
action: @escaping (IsClickPrimaryButton) -> Void?
Expand All @@ -97,8 +97,8 @@ enum ViewKit {
static func useAlert(
title: String,
message: String,
primaryButton: String = "OK",
secondaryButton: String = "Cancel",
primaryButton: String = String(localized: "OK"),
secondaryButton: String = String(localized: "Cancel"),
action: @escaping (IsClickPrimaryButton) -> Void?
) {
let alert = NSAlert()
Expand Down Expand Up @@ -127,8 +127,8 @@ enum ViewKit {
static func useFilePanel(
title: String,
message: String,
primaryButton: String = "OK",
secondaryButton: String = "Cancel",
primaryButton: String = String(localized: "OK"),
secondaryButton: String = String(localized: "Cancel"),
action: @escaping (URL?) -> Void
) {
let panel = NSOpenPanel()
Expand All @@ -147,8 +147,8 @@ enum ViewKit {
static func useDirectoryPanel(
title: String,
message: String,
primaryButton: String = "OK",
secondaryButton: String = "Cancel",
primaryButton: String = String(localized: "OK"),
secondaryButton: String = String(localized: "Cancel"),
action: @escaping (URL?) -> Void
) {
let panel = NSOpenPanel()
Expand All @@ -167,8 +167,8 @@ enum ViewKit {
static func saveFilePanel(
title: String,
message: String,
primaryButton: String = "OK",
secondaryButton: String = "Cancel",
primaryButton: String = String(localized: "OK"),
secondaryButton: String = String(localized: "Cancel"),
action: @escaping (URL?) -> Void
) {
let panel = NSSavePanel()
Expand Down
Loading