Skip to content

Commit

Permalink
Add translation (#6)
Browse files Browse the repository at this point in the history
* Add more translation

* Fixes view
  • Loading branch information
lkebin authored Apr 6, 2023
1 parent 86ed0d8 commit 4cfa6c9
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 57 deletions.
23 changes: 0 additions & 23 deletions GostX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
B532A685285B528D00159BAC /* GostXUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GostXUITests.swift; sourceTree = "<group>"; };
B532A687285B528D00159BAC /* GostXUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GostXUITestsLaunchTests.swift; sourceTree = "<group>"; };
B5AEDDB02864920800C09ED6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
B5AF722C28634A6500BB5F98 /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
B5B0E073285B62B80035A6F2 /* MacExtrasConfigurator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacExtrasConfigurator.swift; sourceTree = "<group>"; };
B5B0E079285C63080035A6F2 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
B5C1CF1529DD6E7C008AA934 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
Expand Down Expand Up @@ -144,7 +143,6 @@
B5AF722B28634A6500BB5F98 /* Frameworks */ = {
isa = PBXGroup;
children = (
B5AF722C28634A6500BB5F98 /* UserNotifications.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -159,7 +157,6 @@
B532A662285B528900159BAC /* Sources */,
B532A663285B528900159BAC /* Frameworks */,
B532A664285B528900159BAC /* Resources */,
B5B0E078285C328C0035A6F2 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -277,26 +274,6 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
B5B0E078285C328C0035A6F2 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n# ${SOURCE_ROOT}/GostX/gost-resource.sh\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
B532A662285B528900159BAC /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
7 changes: 6 additions & 1 deletion GostX/MacExtrasConfigurator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ class MacExtrasConfigurator: NSObject {

private var menu: NSMenu = NSMenu()
private var activeImg: NSImage? = NSImage(systemSymbolName: "network.badge.shield.half.filled", accessibilityDescription: nil)
private var inActiveImg: NSImage? = NSImage(systemSymbolName: "network.badge.shield.half.filled", accessibilityDescription: nil)?.withSymbolConfiguration(NSImage.SymbolConfiguration(hierarchicalColor: NSColor.systemGray))
private var inActiveImg: NSImage? = NSImage(
systemSymbolName: "network.badge.shield.half.filled",
accessibilityDescription: nil
)?.withSymbolConfiguration(
NSImage.SymbolConfiguration(paletteColors: [NSColor.init(red: 75, green: 75, blue: 75, alpha: 0.8)])
)

init(delegate: AppDelegate) {
self.delegate = delegate
Expand Down
34 changes: 11 additions & 23 deletions GostX/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,32 @@
import SwiftUI

struct SettingsView: View {
private enum Tabs: Hashable {
case general, advanced
}
var body: some View {
TabView {
GeneralSettingsView()
ArgumentView()
.tabItem {
Label("Arguments", systemImage: "gear")
Label(NSLocalizedString("Arguments", comment: ""), systemImage: "gear")
}
.tag(Tabs.general)
.tag("argument")
}
.padding(5)
}
}

struct GeneralSettingsView: View {
struct ArgumentView: View {
@AppStorage(defaultsArgumentsKey)
private var arguments = "-L socks5://:1080"

var body: some View {
Form {
if #available(macOS 12.0, *) {
TextEditor(text: $arguments)
.padding(5)
.cornerRadius(20.0)
.shadow(radius: 1.0)
.font(Font.system(size: 12).monospaced())
.frame(minWidth: 350, minHeight: 200, alignment: .leading)
} else {
TextEditor(text: $arguments)
.padding(5)
.cornerRadius(20.0)
.shadow(radius: 1.0)
.font(Font.system(size: 12))
.frame(minWidth: 350, minHeight: 200, alignment: .leading)
}
TextEditor(text: $arguments)
.padding(5)
.cornerRadius(20.0)
.shadow(radius: 1.0)
.font(Font.system(size: 12).monospaced())
.frame(minWidth: 350, minHeight: 200, alignment: .leading)

Text("Note: value saved automatically, line of start with # symbol is ignored.")
Text(NSLocalizedString("argument-description", comment: ""))
.padding(.horizontal, 5)
.font(Font.system(size:12))
.foregroundColor(.gray)
Expand Down
6 changes: 6 additions & 0 deletions en.lproj/Localizable.stringsdict
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>About</key>
<string>About</string>
<key>argument-description</key>
<string>Note: value saved automatically, line of start with # symbol is ignored.</string>
<key>Arguments</key>
<string>Arguments</string>
<key>Preferences...</key>
<string>Preferences...</string>
<key>Quit</key>
Expand Down
26 changes: 16 additions & 10 deletions zh-Hans.lproj/Localizable.stringsdict
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Preferences...</key>
<string>设置...</string>
<key>Quit</key>
<string>退出</string>
<key>Stop</key>
<string>停止</string>
<key>Restart</key>
<string>重启</string>
<key>Start</key>
<string>启动</string>
<key>About</key>
<string>关于</string>
<key>argument-description</key>
<string>备注:参数将自动保存,以 # 开头的行将被忽略</string>
<key>Arguments</key>
<string>参数</string>
<key>Preferences...</key>
<string>设置...</string>
<key>Quit</key>
<string>退出</string>
<key>Stop</key>
<string>停止</string>
<key>Restart</key>
<string>重启</string>
<key>Start</key>
<string>启动</string>
<key>StringKey</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
Expand Down

0 comments on commit 4cfa6c9

Please sign in to comment.