Skip to content

Commit 68b2e08

Browse files
committed
feat: set English as default language
1. Change default language to English 2. Update coin display names to full English names 3. Improve language switch text 4. Convert comments to English 5. Fix language toggle text
1 parent f424fe3 commit 68b2e08

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

main.swift

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
2525
("DOGE", "DOGEUSDT", "Ð")
2626
]
2727

28-
// 语言本地化
28+
// Localization
2929
private let localizedStrings: [String: [Bool: String]] = [
3030
"loading": [true: "Loading...", false: "加载中..."],
3131
"addCoin": [true: "Add Custom Coin...", false: "添加自定义币种..."],
@@ -81,7 +81,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
8181
func applicationDidFinishLaunching(_ aNotification: Notification) {
8282
statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
8383

84-
// 设置菜单栏显示
84+
// Set up menu bar display
8585
if let button = statusItem.button {
8686
button.image = nil
8787
button.title = "\(currentIcon) \(currentPrice)"
@@ -167,7 +167,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
167167
currentApiIndex = index
168168
isAutoSwitchApi = false
169169
setupMenu()
170-
updatePrice() // 立即更新价格以测试新API
170+
updatePrice() // Update price immediately to test new API
171171
}
172172
}
173173

@@ -181,7 +181,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
181181
}
182182

183183
func validateAndAddCoin(_ symbol: String) {
184-
// 检查是否已存在
184+
// Check if the coin already exists
185185
if symbols.contains(where: { $0.1 == symbol }) {
186186
DispatchQueue.main.async {
187187
self.currentSymbol = symbol
@@ -220,10 +220,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
220220
}
221221

222222
func formatPrice(_ price: Double) -> String {
223-
// 对于小于0.01的价格显示8位小数
224-
// 对于0.01-1之间的价格显示6位小数
225-
// 对于1-100之间的价格显示4位小数
226-
// 对于100以上的价格显示2位小数
223+
// Format price based on its value
227224
let decimals: Int
228225
if price < 0.01 {
229226
decimals = 8
@@ -235,10 +232,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
235232
decimals = 2
236233
}
237234

238-
// 格式化价格
235+
// Format price
239236
let formattedPrice = String(format: "%.\(decimals)f", price)
240237

241-
// 移除末尾的0,但保留小数点后至少一位
238+
// Remove trailing zeros, but keep at least one decimal place
242239
var trimmed = formattedPrice
243240
while trimmed.hasSuffix("0") && trimmed.contains(".") && trimmed.split(separator: ".")[1].count > 1 {
244241
trimmed.removeLast()
@@ -290,7 +287,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
290287

291288
NSApp.activate(ignoringOtherApps: true)
292289

293-
// 显示对话框
290+
// Show alert
294291
let response = alert.runModal()
295292

296293
if response == .alertFirstButtonReturn {
@@ -359,11 +356,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
359356
let alert = NSAlert()
360357
alert.messageText = localized("aboutTitle")
361358
alert.informativeText = localized("aboutMessage")
362-
alert.window.maxSize = NSSize(width: 500, height: 1000) // 增加最大宽度
363-
alert.window.minSize = NSSize(width: 400, height: 200) // 设置最小宽度
359+
alert.window.maxSize = NSSize(width: 500, height: 1000) // Increase maximum width
360+
alert.window.minSize = NSSize(width: 400, height: 200) // Set minimum width
364361
alert.alertStyle = .informational
365362

366-
// 添加应用图标
363+
// Add application icon
367364
if let iconURL = Bundle.main.url(forResource: "AppIcon", withExtension: "icns"),
368365
let image = NSImage(contentsOf: iconURL) {
369366
alert.icon = image

0 commit comments

Comments
 (0)