Repository navigation
Expand file tree
/
Copy pathchanges-current.patch
More file actions
1828 lines (1797 loc) · 144 KB
/
Copy pathchanges-current.patch
File metadata and controls
1828 lines (1797 loc) · 144 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--- a/Ath10k Connectivity/Ath10k_ConnectivityApp.swift
+++ b/Ath10k Connectivity/Ath10k_ConnectivityApp.swift
@@ -43,9 +43,9 @@
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
if !model.usesAgent && (model.canDisconnect || model.canCancel) {
let alert = NSAlert()
- alert.messageText = "Encerrar a conexão Wi-Fi?"
- alert.informativeText = "O app mantém a autenticação e a renovação das chaves. Sair encerra a conexão."
- alert.addButton(withTitle: "Sair"); alert.addButton(withTitle: "Cancelar")
+ alert.messageText = L10n.text("Encerrar a conexão Wi-Fi?")
+ alert.informativeText = L10n.text("O app mantém a autenticação e a renovação das chaves. Sair encerra a conexão.")
+ alert.addButton(withTitle: L10n.text("Sair")); alert.addButton(withTitle: L10n.text("Cancelar"))
if alert.runModal() != .alertFirstButtonReturn { return .terminateCancel }
}
return .terminateNow
@@ -91,26 +91,26 @@
@ObservedObject var model: NetworkModel
let openMain: @MainActor () -> Void
var body: some View {
- Text(model.linkUp ? model.connectedSSID : "Wi-Fi desconectado")
+ Text(model.linkUp ? model.connectedSSID : L10n.text("Wi-Fi desconectado"))
if model.linkUp {
- Text(model.addresses.ipv4.first ?? (model.addresses.ipv6.first ?? "Aguardando endereço IP…"))
- Text(model.internet.rawValue)
- Button("Desconectar") { model.disconnect() }.disabled(!model.canDisconnect)
- } else if model.canCancel { Button("Cancelar conexão") { model.cancel() } }
+ Text(model.addresses.ipv4.first ?? (model.addresses.ipv6.first ?? L10n.text("Aguardando endereço IP…")))
+ Text(model.internet.localizedDescription)
+ Button(L10n.text("Desconectar")) { model.disconnect() }.disabled(!model.canDisconnect)
+ } else if model.canCancel { Button(L10n.text("Cancelar conexão")) { model.cancel() } }
Divider()
ForEach(Array(model.sortedNetworks.prefix(20))) { network in
Button {
if !model.connectFromMenu(network) { openMain() }
} label: {
- Label("\(network.name) · \(network.band) · canal \(network.channel)", systemImage: network.secure ? "lock.fill" : "wifi")
+ Label(L10n.format("%@ · %@ · canal %ld", network.name, network.band, network.channel), systemImage: network.secure ? "lock.fill" : "wifi")
}.disabled(!network.connectable)
}
- if model.networks.isEmpty { Text(model.scanning ? "Pesquisando redes…" : "Nenhuma rede disponível") }
- Button(model.scanning ? "Cancelar busca" : "Pesquisar redes") { model.refresh() }.disabled(!model.available)
- if model.autoJoinPaused { Button("Retomar conexão automática") { model.resumeAutoJoin() } }
+ if model.networks.isEmpty { Text(model.scanning ? L10n.text("Pesquisando redes…") : L10n.text("Nenhuma rede disponível")) }
+ Button(model.scanning ? L10n.text("Cancelar busca") : L10n.text("Pesquisar redes")) { model.refresh() }.disabled(!model.available)
+ if model.autoJoinPaused { Button(L10n.text("Retomar conexão automática")) { model.resumeAutoJoin() } }
Divider()
- Button("Redes, preferências e diagnóstico…") { openMain() }
- Button("Sobre Ath10k Connectivity") { NSApp.orderFrontStandardAboutPanel(nil); NSApp.activate(ignoringOtherApps: true) }
- Button("Sair do Ath10k Connectivity") { NSApp.terminate(nil) }
+ Button(L10n.text("Redes, preferências e diagnóstico…")) { openMain() }
+ Button(L10n.text("Sobre Ath10k Connectivity")) { NSApp.orderFrontStandardAboutPanel(nil); NSApp.activate(ignoringOtherApps: true) }
+ Button(L10n.text("Sair do Ath10k Connectivity")) { NSApp.terminate(nil) }
}
}
--- a/Ath10k Connectivity/ConnectionAgent.swift
+++ b/Ath10k Connectivity/ConnectionAgent.swift
@@ -114,7 +114,7 @@
init(model: NetworkModel) { self.model = model }
func start() {
do { try AgentRegistration.installIfNeeded() }
- catch { model?.status = "Não foi possível iniciar o serviço de Wi-Fi: \(error.localizedDescription)"; retryAt = Date().addingTimeInterval(5); return }
+ catch { model?.status = L10n.format("Não foi possível iniciar o serviço de Wi-Fi: %@", error.localizedDescription); retryAt = Date().addingTimeInterval(5); return }
open()
}
private func open() {
@@ -130,7 +130,7 @@
guard current == generation else { return }
generation &+= 1; let old = connection; connection = nil; trusted = false; polling = false; old?.invalidate()
model?.available = false; model?.canConnect = false; model?.canDisconnect = false; model?.canCancel = false
- model?.status = "Aguardando o serviço de Wi-Fi…"; retryAt = Date().addingTimeInterval(2)
+ model?.status = L10n.text("Aguardando o serviço de Wi-Fi…"); retryAt = Date().addingTimeInterval(2)
}
private func receive(_ data: Data?, generation current: UInt64, fromPoll: Bool) {
guard current == generation, let value = connection else { return }
@@ -172,7 +172,9 @@
let stamp = (attributes[.modificationDate] as? Date)?.timeIntervalSince1970 ?? 0
let configuration: [String: Any] = [
"Label": ConnectionAgentServer.name, "ProgramArguments": [executable.path, "--agent", "--generation", String(stamp)],
- "MachServices": [ConnectionAgentServer.name: true], "RunAtLoad": true, "KeepAlive": true,
+ "MachServices": [ConnectionAgentServer.name: true],
+ // The headless service must use the GUI’s effective app language.
+ "EnvironmentVariables": ["ATH10K_APP_LANGUAGE": L10n.language], "RunAtLoad": true, "KeepAlive": true,
"ProcessType": "Background", "ThrottleInterval": 5, "LimitLoadToSessionType": "Aqua"
]
let bytes = try PropertyListSerialization.data(fromPropertyList: configuration, format: .xml, options: 0)
--- a/Ath10k Connectivity/ContentView.swift
+++ b/Ath10k Connectivity/ContentView.swift
@@ -14,14 +14,14 @@
Image(nsImage: NSApp.applicationIconImage).resizable().frame(width: 54, height: 54)
VStack(alignment: .leading, spacing: 4) {
Text("Ath10k Connectivity").font(.title2.bold())
- Text(model.linkUp ? model.connectedSSID : "Seu adaptador, suas redes.").foregroundStyle(.secondary)
+ Text(model.linkUp ? model.connectedSSID : L10n.text("Seu adaptador, suas redes.")).foregroundStyle(.secondary)
}
Spacer()
- Label(model.linkUp ? "Associado" : "Desconectado", systemImage: model.linkUp ? "wifi" : "wifi.slash")
+ Label(model.linkUp ? L10n.text("Associado") : L10n.text("Desconectado"), systemImage: model.linkUp ? "wifi" : "wifi.slash")
.foregroundStyle(model.linkUp ? Color.green : Color.secondary)
}
- Picker("Página", selection: $tab) {
- Text("Redes").tag(0); Text("Redes conhecidas").tag(1); Text("Preferências").tag(2)
+ Picker(L10n.text("Página"), selection: $tab) {
+ Text(L10n.text("Redes")).tag(0); Text(L10n.text("Redes conhecidas")).tag(1); Text(L10n.text("Preferências")).tag(2)
}.pickerStyle(.segmented)
if tab == 0 { networks }
else if tab == 1 { savedNetworks }
@@ -36,33 +36,33 @@
.font(.caption).foregroundStyle(.secondary)
if !model.addresses.ipv4.isEmpty { Text("IPv4: " + model.addresses.ipv4.joined(separator: ", ")).font(.caption.monospaced()).textSelection(.enabled) }
if !model.addresses.ipv6.isEmpty { Text("IPv6: " + model.addresses.ipv6.joined(separator: ", ")).font(.caption.monospaced()).textSelection(.enabled) }
- if !model.addresses.router.isEmpty { Text("Roteador: " + model.addresses.router).font(.caption.monospaced()).textSelection(.enabled) }
- if model.internet == .portal { Button("Abrir página de autenticação") { model.openPortal() } }
+ if !model.addresses.router.isEmpty { Text(L10n.format("Roteador: %@", model.addresses.router)).font(.caption.monospaced()).textSelection(.enabled) }
+ if model.internet == .portal { Button(L10n.text("Abrir página de autenticação")) { model.openPortal() } }
}
}.frame(maxWidth: .infinity, alignment: .leading)
}.padding(6)
}
if !model.credentialMessage.isEmpty { Text(model.credentialMessage).font(.caption).textSelection(.enabled) }
- DisclosureGroup("Diagnóstico") {
+ DisclosureGroup(L10n.text("Diagnóstico")) {
VStack(alignment: .leading, spacing: 8) {
Text(model.diagnostics).font(.caption.monospaced()).textSelection(.enabled)
HStack {
- Button("Copiar diagnóstico sem dados da rede") { model.copyDiagnostics() }
- Button("Recuperar driver") { model.recover() }
+ Button(L10n.text("Copiar diagnóstico sem dados da rede")) { model.copyDiagnostics() }
+ Button(L10n.text("Recuperar driver")) { model.recover() }
}
}.frame(maxWidth: .infinity, alignment: .leading).padding(.top, 8)
}
- Text("\(appVersion) · WPA2-Personal/AES e redes abertas · Fechar a janela mantém a conexão na barra de menus.")
+ Text(L10n.format("%@ · WPA2-Personal/AES e redes abertas · Fechar a janela mantém a conexão na barra de menus.", appVersion))
.font(.caption2).foregroundStyle(.secondary)
}.padding(24).frame(minWidth: 760, minHeight: 640)
}
private var networks: some View {
VStack(alignment: .leading, spacing: 12) {
HStack {
- Text("Redes disponíveis").font(.headline)
+ Text(L10n.text("Redes disponíveis")).font(.headline)
if model.scanning { ProgressView().controlSize(.small) }
Spacer()
- Button(model.scanning ? "Cancelar busca" : "Pesquisar redes") { model.refresh() }
+ Button(model.scanning ? L10n.text("Cancelar busca") : L10n.text("Pesquisar redes")) { model.refresh() }
.disabled(!model.available || (!model.editing && !model.linkUp))
}
List(selection: $model.selection) {
@@ -80,7 +80,7 @@
}
Spacer()
VStack(alignment: .trailing, spacing: 4) {
- Text("\(network.band) · Canal \(network.channel)")
+ Text(L10n.format("%@ · Canal %ld", network.band, network.channel))
Text(network.security + (network.dfs ? " · DFS" : "")).font(.caption).foregroundStyle(.secondary)
Text(network.signalText).font(.caption2).foregroundStyle(.secondary)
}
@@ -91,67 +91,67 @@
if model.networks.isEmpty {
VStack(spacing: 8) {
Image(systemName: "wifi.magnifyingglass").font(.largeTitle)
- Text(model.scanning ? "Pesquisando redes…" : "Nenhuma rede disponível")
- Text("A busca inicial pode levar cerca de 35 segundos.").font(.caption)
+ Text(model.scanning ? L10n.text("Pesquisando redes…") : L10n.text("Nenhuma rede disponível"))
+ Text(L10n.text("A busca inicial pode levar cerca de 35 segundos.")).font(.caption)
}.foregroundStyle(.secondary).allowsHitTesting(false)
}
}
if model.selected?.hidden == true {
- TextField("Nome exato da rede oculta (SSID)", text: $model.hiddenSSID)
+ TextField(L10n.text("Nome exato da rede oculta (SSID)"), text: $model.hiddenSSID)
.textFieldStyle(.roundedBorder).disabled(!model.editing || !model.hiddenSSIDAvailable)
- Text("O nome será usado somente para o BSSID selecionado. A busca permanece passiva.")
+ Text(L10n.text("O nome será usado somente para o BSSID selecionado. A busca permanece passiva."))
.font(.caption).foregroundStyle(.secondary)
}
HStack {
if model.selected?.secure == true {
- SecureField("Senha WPA2 (vazio: usar Keychain)", text: $model.password)
+ SecureField(L10n.text("Senha WPA2 (vazio: usar Keychain)"), text: $model.password)
.textFieldStyle(.roundedBorder).disabled(!model.editing)
.onSubmit { if model.canConnect { model.connect() } }
- } else { Text(model.selected == nil ? "Selecione uma rede" : "Rede aberta: sem senha").foregroundStyle(.secondary) }
+ } else { Text(model.selected == nil ? L10n.text("Selecione uma rede") : L10n.text("Rede aberta: sem senha")).foregroundStyle(.secondary) }
Spacer()
- if model.canDisconnect { Button("Desconectar") { model.disconnect() } }
- else if model.canCancel { Button("Cancelar conexão") { model.cancel() } }
- Button("Conectar") { model.connect() }.buttonStyle(.borderedProminent)
+ if model.canDisconnect { Button(L10n.text("Desconectar")) { model.disconnect() } }
+ else if model.canCancel { Button(L10n.text("Cancelar conexão")) { model.cancel() } }
+ Button(L10n.text("Conectar")) { model.connect() }.buttonStyle(.borderedProminent)
.disabled(!model.canConnect || !model.selectionConnectable)
}
if model.selected?.secure == true {
- Toggle("Salvar senha no Keychain após conectar", isOn: $model.rememberPassword).disabled(!model.editing)
+ Toggle(L10n.text("Salvar senha no Keychain após conectar"), isOn: $model.rememberPassword).disabled(!model.editing)
}
- if model.autoJoinPaused { Button("Retomar conexão automática") { model.resumeAutoJoin() } }
- if !model.extended && model.available { Text("Scan novo, recuperação e renovação WPA2 requerem Ath10kMac 0.0.73.").font(.caption).foregroundStyle(.orange) }
+ if model.autoJoinPaused { Button(L10n.text("Retomar conexão automática")) { model.resumeAutoJoin() } }
+ if !model.extended && model.available { Text(L10n.text("Scan novo, recuperação e renovação WPA2 requerem Ath10kMac 0.0.73.")).font(.caption).foregroundStyle(.orange) }
}
}
private var savedNetworks: some View {
VStack(alignment: .leading, spacing: 12) {
- Text("Redes salvas após uma conexão bem-sucedida. A senha fica somente no Keychain.")
+ Text(L10n.text("Redes salvas após uma conexão bem-sucedida. A senha fica somente no Keychain."))
.font(.caption).foregroundStyle(.secondary)
List {
ForEach(model.profiles.sorted { $0.priority > $1.priority }) { profile in
SavedNetworkRow(profile: profile, model: model)
}
}.overlay {
- if model.profiles.isEmpty { Text("Conecte a uma rede para adicioná-la aqui.").foregroundStyle(.secondary).allowsHitTesting(false) }
+ if model.profiles.isEmpty { Text(L10n.text("Conecte a uma rede para adicioná-la aqui.")).foregroundStyle(.secondary).allowsHitTesting(false) }
}.frame(minHeight: 280)
- Text("A prioridade mais alta é tentada primeiro. Entre APs da mesma rede, preferimos o sinal mais forte. Redes abertas só entram na conexão automática quando já foram salvas por você.")
+ Text(L10n.text("A prioridade mais alta é tentada primeiro. Entre APs da mesma rede, preferimos o sinal mais forte. Redes abertas só entram na conexão automática quando já foram salvas por você."))
.font(.caption).foregroundStyle(.secondary)
}
}
private var preferences: some View {
Form {
- Toggle("Conectar automaticamente às redes conhecidas", isOn: $model.autoJoin)
- Toggle("Recuperar o driver após interrupção ou suspensão", isOn: $model.autoRecover)
- Toggle("Pesquisar redes a cada dois minutos", isOn: $model.periodicScan)
- Toggle("Trocar de AP quando o sinal estiver fraco", isOn: $model.roaming)
- Text("Roaming usa uma nova associação e pode interromper brevemente o tráfego. APs da mesma rede precisam ter ganho de pelo menos 12 dB por 12 segundos.")
+ Toggle(L10n.text("Conectar automaticamente às redes conhecidas"), isOn: $model.autoJoin)
+ Toggle(L10n.text("Recuperar o driver após interrupção ou suspensão"), isOn: $model.autoRecover)
+ Toggle(L10n.text("Pesquisar redes a cada dois minutos"), isOn: $model.periodicScan)
+ Toggle(L10n.text("Trocar de AP quando o sinal estiver fraco"), isOn: $model.roaming)
+ Text(L10n.text("Roaming usa uma nova associação e pode interromper brevemente o tráfego. APs da mesma rede precisam ter ganho de pelo menos 12 dB por 12 segundos."))
.font(.caption).foregroundStyle(.secondary)
- Toggle("Economia de energia Wi-Fi (STA)", isOn: $model.powerSaving).disabled(!model.radioOptionsAvailable)
- Toggle("Verificar Internet pela interface Ath10k", isOn: $model.verifyInternet)
- Text("A verificação consulta captive.apple.com pela interface Wi-Fi, até uma vez por minuto. Um resultado inconclusivo não significa que a Internet parou.")
+ Toggle(L10n.text("Economia de energia Wi-Fi (STA)"), isOn: $model.powerSaving).disabled(!model.radioOptionsAvailable)
+ Toggle(L10n.text("Verificar Internet pela interface Ath10k"), isOn: $model.verifyInternet)
+ Text(L10n.text("A verificação consulta captive.apple.com pela interface Wi-Fi, até uma vez por minuto. Um resultado inconclusivo não significa que a Internet parou."))
.font(.caption).foregroundStyle(.secondary)
- Toggle("Abrir ao iniciar a sessão", isOn: Binding(get: { model.startAtLogin }, set: { model.setLogin($0) }))
- Text("Instale o app em /Applications antes de ativar o início automático. A autorização é gerenciada pelos Ajustes do Sistema.")
+ Toggle(L10n.text("Abrir ao iniciar a sessão"), isOn: Binding(get: { model.startAtLogin }, set: { model.setLogin($0) }))
+ Text(L10n.text("Instale o app em /Applications antes de ativar o início automático. A autorização é gerenciada pelos Ajustes do Sistema."))
.font(.caption).foregroundStyle(.secondary)
- Text("Conexão manual interrompida por você pausa a conexão automática até clicar em Retomar. Senha incorreta gera espera progressiva entre tentativas.")
+ Text(L10n.text("Conexão manual interrompida por você pausa a conexão automática até clicar em Retomar. Senha incorreta gera espera progressiva entre tentativas."))
.font(.caption).foregroundStyle(.secondary)
Spacer()
}.frame(minHeight: 280)
@@ -168,20 +168,20 @@
HStack {
Label(profile.name, systemImage: profile.secure ? "lock.fill" : "lock.open")
Spacer()
- Button("Esquecer…") { confirmForget = true }
+ Button(L10n.text("Esquecer…")) { confirmForget = true }
}
HStack {
- Toggle("Conexão automática", isOn: Binding(get: { profile.autoJoin }, set: {
+ Toggle(L10n.text("Conexão automática"), isOn: Binding(get: { profile.autoJoin }, set: {
var changed = profile; changed.autoJoin = $0; model.updateProfile(changed)
}))
Spacer()
- Stepper("Prioridade: \(profile.priority)", value: Binding(get: { profile.priority }, set: {
+ Stepper(L10n.format("Prioridade: %ld", profile.priority), value: Binding(get: { profile.priority }, set: {
var changed = profile; changed.priority = $0; model.updateProfile(changed)
- }), in: -20...20).frame(width: 190)
+ }), in: 0...100).frame(width: 190)
}
}.padding(.vertical, 5)
- .confirmationDialog("Esquecer \(profile.name)?", isPresented: $confirmForget) {
- Button("Esquecer rede e senha", role: .destructive) { model.forget(profile) }
- } message: { Text("Remove o perfil e a senha salva. A conexão atual continua até você desconectar.") }
+ .confirmationDialog(L10n.format("Esquecer %@?", profile.name), isPresented: $confirmForget) {
+ Button(L10n.text("Esquecer rede e senha"), role: .destructive) { model.forget(profile) }
+ } message: { Text(L10n.text("Remove o perfil e a senha salva. A conexão atual continua até você desconectar.")) }
}
}
--- a/Ath10k Connectivity/Driver/AthDriver.mm
+++ b/Ath10k Connectivity/Driver/AthDriver.mm
@@ -8,6 +8,7 @@
#include "ScanFreshness.hpp"
#include "Ath10kSupplicant.hpp"
#import "AthDriver.h"
+#import "AthLocalization.h"
struct MacCrypto {
static bool hmac(const uint8_t *k,size_t kl,const uint8_t *p,size_t n,uint8_t *out){CCHmac(kCCHmacAlgSHA1,k,kl,p,n,out);return true;}
static bool decrypt(const uint8_t *key,const uint8_t *in,uint8_t *out){size_t done=0;return CCCrypt(kCCDecrypt,kCCAlgorithmAES,kCCOptionECBMode,key,16,nullptr,in,16,out,16,&done)==kCCSuccess && done==16;}
@@ -32,7 +33,7 @@
@end
@implementation AthDriver
-(instancetype)init {
- if((self=[super init])){self.status=@"Procurando a kext…";self.password=@"";self.hiddenSSID=@"";self.diagnostics=@"Sem comunicação com o driver.";self.networks=@[];self.selectedIndex=-1;self.editingEnabled=YES;self.interfaceName=@"";self.connectedSSID=@"";self.connectedBSSID=@"";self.driverVersion=@"";self.signalDbm=INT32_MIN;_rows=[NSMutableArray array];}return self;
+ if((self=[super init])){self.status=AthL(@"Procurando a kext…");self.password=@"";self.hiddenSSID=@"";self.diagnostics=AthL(@"Sem comunicação com o driver.");self.networks=@[];self.selectedIndex=-1;self.editingEnabled=YES;self.interfaceName=@"";self.connectedSSID=@"";self.connectedBSSID=@"";self.driverVersion=@"";self.signalDbm=INT32_MIN;_rows=[NSMutableArray array];}return self;
}
-(BOOL)sessionActive{return _session;}
-(BOOL)sessionFailed{return _failed;}
@@ -60,9 +61,9 @@
-(void)openDriver {
if(_driver||_sleeping)return;
_service=IOServiceGetMatchingService(kIOMasterPortDefault,IOServiceMatching("Ath10kPCIDevice"));
- if(!_service){self.status=@"Aguardando Ath10kMac. As redes aparecerão quando a kext estiver disponível.";_retryAt=CFAbsoluteTimeGetCurrent()+2;return;}
+ if(!_service){self.status=AthL(@"Aguardando Ath10kMac. As redes aparecerão quando a kext estiver disponível.");_retryAt=CFAbsoluteTimeGetCurrent()+2;return;}
kern_return_t r=IOServiceOpen(_service,mach_task_self(),AthControl::clientType,&_driver);
- if(r){IOObjectRelease(_service);_service=0;_driver=0;self.status=[NSString stringWithFormat:@"Não foi possível abrir a kext (0x%x). Confira a versão e se outro app mantém a sessão.",r];_retryAt=CFAbsoluteTimeGetCurrent()+2;return;}
+ if(r){IOObjectRelease(_service);_service=0;_driver=0;self.status=[NSString stringWithFormat:AthL(@"Não foi possível abrir a kext (0x%x). Confira a versão e se outro app mantém a sessão."),r];_retryAt=CFAbsoluteTimeGetCurrent()+2;return;}
self.available=YES;_openedAt=CFAbsoluteTimeGetCurrent();[self findInterface];
}
-(void)findInterface {
@@ -83,22 +84,22 @@
if([self call:AthControl::BSS request:&q response:&r]||r.length<44||r.data[0]>32)continue;
uint16_t rsn=AthSecurity::le16(r.data+42);if(rsn>r.length-44)continue;
[_rows addObject:[NSData dataWithBytes:r.data length:r.length]];
- NSString *ssid=[[NSString alloc] initWithBytes:r.data+8 length:r.data[0] encoding:NSUTF8StringEncoding];if(!ssid.length)ssid=r.data[0]?@"SSID binário":@"Rede oculta";
+ NSString *ssid=[[NSString alloc] initWithBytes:r.data+8 length:r.data[0] encoding:NSUTF8StringEncoding];if(!ssid.length)ssid=r.data[0]?AthL(@"SSID binário"):AthL(@"Rede oculta");
NSInteger signal=INT32_MIN;if(r.length>=48u+rsn){uint32_t snr=read32(r.data+44+rsn);if(snr<=95)signal=(NSInteger)snr-95;}
BOOL hidden=r.data[0]==0 || (r.length>=52u+rsn && (read32(r.data+48+rsn)&2));
- if(hidden)ssid=@"Rede oculta";
- [items addObject:@{@"credentialID":[[NSData dataWithBytes:r.data+8 length:r.data[0]] base64EncodedStringWithOptions:0],@"ssid":ssid,@"bssid":macString(r.data+2),@"channel":@(r.data[40]),@"signal":@(signal),@"security":r.data[1]?(r.data[41]?@"WPA2 AES":@"Segurança não suportada"):@"Aberta",@"secure":@(r.data[1]!=0),@"supported":@((!r.data[1]||r.data[41]) && (!(r.data[40]>=52 && r.data[40]<=144)||self.stationDFSAvailable)),@"hidden":@(hidden),@"index":@(_rows.count-1)}];
+ if(hidden)ssid=AthL(@"Rede oculta");
+ [items addObject:@{@"credentialID":[[NSData dataWithBytes:r.data+8 length:r.data[0]] base64EncodedStringWithOptions:0],@"ssid":ssid,@"bssid":macString(r.data+2),@"channel":@(r.data[40]),@"signal":@(signal),@"security":r.data[1]?(r.data[41]?@"WPA2 AES":AthL(@"Segurança não suportada")):AthL(@"Aberta"),@"secure":@(r.data[1]!=0),@"supported":@((!r.data[1]||r.data[41]) && (!(r.data[40]>=52 && r.data[40]<=144)||self.stationDFSAvailable)),@"hidden":@(hidden),@"index":@(_rows.count-1)}];
}
self.networks=items;self.selectedIndex=-1;for(NSUInteger i=0;i<items.count;++i)if([items[i][@"bssid"] isEqual:selectedBSSID])self.selectedIndex=i;
if(self.selectedIndex<0 && items.count)self.selectedIndex=0;_loaded=YES;
}
-(BOOL)refresh {
if(!_driver)return NO;
- if(!self.extensionsAvailable){AthControl::Response st{};if(![self call:AthControl::Status request:nullptr response:&st] && (st.flags&2))[self loadRows:st];self.status=@"Esta kext oferece somente o cache inicial. Scan novo requer Ath10kMac 0.0.73.";return NO;}
+ if(!self.extensionsAvailable){AthControl::Response st{};if(![self call:AthControl::Status request:nullptr response:&st] && (st.flags&2))[self loadRows:st];self.status=AthL(@"Esta kext oferece somente o cache inicial. Scan novo requer Ath10kMac 0.0.73.");return NO;}
if(self.scanning){AthControl::Request q{};q.index=1;[self call:AthControl::Scan request:&q response:nullptr];return NO;}
kern_return_t r=[self call:AthControl::Scan request:nullptr response:nullptr];
- if(!r){_scanFreshness.accepted();self.scanSucceeded=NO;self.canConnect=NO;self.scanning=YES;self.status=@"Pesquisando redes nos canais habilitados pelo driver…";}
- else self.status=[NSString stringWithFormat:@"Scan indisponível no momento (0x%x). Aguarde a associação ou a negociação de chaves.",r];
+ if(!r){_scanFreshness.accepted();self.scanSucceeded=NO;self.canConnect=NO;self.scanning=YES;self.status=AthL(@"Pesquisando redes nos canais habilitados pelo driver…");}
+ else self.status=[NSString stringWithFormat:AthL(@"Scan indisponível no momento (0x%x). Aguarde a associação ou a negociação de chaves."),r];
return r==KERN_SUCCESS;
}
-(void)connect {
@@ -108,22 +109,22 @@
NSString *selectedSSID=self.networks[(NSUInteger)self.selectedIndex][@"ssid"];
if(hidden){
NSData *name=[self.hiddenSSID dataUsingEncoding:NSUTF8StringEncoding];
- if(!self.hiddenSSIDAvailable || !name.length || name.length>32){self.status=@"Informe o SSID oculto (1 a 32 bytes UTF-8). Requer kext 0.0.82.";return;}
+ if(!self.hiddenSSIDAvailable || !name.length || name.length>32){self.status=AthL(@"Informe o SSID oculto (1 a 32 bytes UTF-8). Requer kext 0.0.82.");return;}
b[0]=(uint8_t)name.length;memset(b+8,0,32);memcpy(b+8,name.bytes,name.length);selectedSSID=self.hiddenSSID;
}
- if(b[40]>=52 && b[40]<=144 && !self.stationDFSAvailable){self.status=@"Conexão DFS ainda não habilitada. Use canais 1–13, 36–48 ou 149–165.";return;}
- if(!b[0] || (b[1]&&!b[41])){self.status=@"Esta rede exige uma segurança ainda não suportada ou não informa o SSID.";return;}
+ if(b[40]>=52 && b[40]<=144 && !self.stationDFSAvailable){self.status=AthL(@"Conexão DFS ainda não habilitada. Use canais 1–13, 36–48 ou 149–165.");return;}
+ if(!b[0] || (b[1]&&!b[41])){self.status=AthL(@"Esta rede exige uma segurança ainda não suportada ou não informa o SSID.");return;}
AthControl::Response st{};if([self call:AthControl::Status request:nullptr response:&st])return;
_secure=b[1];if(_secure){NSData *password=[self.password dataUsingEncoding:NSUTF8StringEncoding];uint8_t pmk[32]{},nonce[32]{};
bool ok=password.length>=8 && password.length<=63 && CCKeyDerivationPBKDF(kCCPBKDF2,(const char *)password.bytes,password.length,b+8,b[0],kCCPRFHmacAlgSHA1,4096,pmk,32)==kCCSuccess && MacCrypto::random(nonce,32) && _supplicant.begin(pmk,nonce,st.local,b+2,b+44,AthSecurity::le16(b+42));
AthSecurity::wipe(pmk,32);AthSecurity::wipe(nonce,32);self.password=@"";
- if(!ok){_supplicant.reset();self.status=@"Confira a senha WPA2: 8 a 63 bytes. Não foi possível iniciar a negociação.";return;}
+ if(!ok){_supplicant.reset();self.status=AthL(@"Confira a senha WPA2: 8 a 63 bytes. Não foi possível iniciar a negociação.");return;}
}
AthControl::Request q{};q.index=hidden?1:0;q.length=8+b[0];memcpy(q.data,b,q.length);kern_return_t r=[self call:AthControl::Connect request:&q response:nullptr];
- if(r){_supplicant.reset();self.status=[NSString stringWithFormat:@"Não iniciou a conexão (0x%x). Verifique o diagnóstico e se a interface está habilitada.",r];return;}
+ if(r){_supplicant.reset();self.status=[NSString stringWithFormat:AthL(@"Não iniciou a conexão (0x%x). Verifique o diagnóstico e se a interface está habilitada."),r];return;}
_session=YES;_failed=NO;_failureMessage=nil;_connectedAt=CFAbsoluteTimeGetCurrent();_authorized=NO;_m4Sent=NO;
self.connectedSSID=selectedSSID;self.connectedBSSID=macString(b+2);
- self.canConnect=NO;self.editingEnabled=NO;self.status=@"Associando à rede…";
+ self.canConnect=NO;self.editingEnabled=NO;self.status=AthL(@"Associando à rede…");
}
-(void)fail:(NSString *)message {
_failed=YES;_failureMessage=[message copy];self.status=message;
@@ -133,15 +134,15 @@
-(void)cancel {
if(!_session||_disconnecting)return;
kern_return_t r=[self call:self.extensionsAvailable?AthControl::Cancel:AthControl::Disconnect request:nullptr response:nullptr];
- if(r){self.status=[NSString stringWithFormat:@"Não foi possível cancelar (0x%x).",r];return;}
- _disconnecting=YES;_supplicant.reset();AthSecurity::wipe(_pending,sizeof(_pending));AthSecurity::wipe(_pendingKeys,sizeof(_pendingKeys));_pendingLength=0;_keyOperation=0;self.status=@"Cancelando e liberando a sessão no firmware…";
+ if(r){self.status=[NSString stringWithFormat:AthL(@"Não foi possível cancelar (0x%x)."),r];return;}
+ _disconnecting=YES;_supplicant.reset();AthSecurity::wipe(_pending,sizeof(_pending));AthSecurity::wipe(_pendingKeys,sizeof(_pendingKeys));_pendingLength=0;_keyOperation=0;self.status=AthL(@"Cancelando e liberando a sessão no firmware…");
}
-(void)disconnect {
if(_disconnecting || !_session)return;
if(!self.canDisconnect){[self cancel];return;}
kern_return_t r=[self call:AthControl::Disconnect request:nullptr response:nullptr];
- if(r){self.status=[NSString stringWithFormat:@"Não foi possível desconectar (0x%x).",r];return;}
- _disconnecting=YES;_supplicant.reset();AthSecurity::wipe(_pending,sizeof(_pending));AthSecurity::wipe(_pendingKeys,sizeof(_pendingKeys));_pendingLength=0;_keyOperation=0;self.status=@"Desconectando…";
+ if(r){self.status=[NSString stringWithFormat:AthL(@"Não foi possível desconectar (0x%x)."),r];return;}
+ _disconnecting=YES;_supplicant.reset();AthSecurity::wipe(_pending,sizeof(_pending));AthSecurity::wipe(_pendingKeys,sizeof(_pendingKeys));_pendingLength=0;_keyOperation=0;self.status=AthL(@"Desconectando…");
}
-(BOOL)disconnectForRoaming {
if(!self.canDisconnect || self.scanning || _held || _pendingLength || _keyOperation || _supplicant.pairwisePending())return NO;
@@ -149,14 +150,14 @@
}
-(void)recover {
if(!_driver){_retryAt=0;[self openDriver];return;}
- if(!self.extensionsAvailable){self.status=@"Recuperação pelo app requer Ath10kMac 0.0.73.";return;}
+ if(!self.extensionsAvailable){self.status=AthL(@"Recuperação pelo app requer Ath10kMac 0.0.73.");return;}
CFTimeInterval now=CFAbsoluteTimeGetCurrent();if(now-_lastRecovery<20)return;
if(now-_recoveryWindow>300){_recoveryWindow=now;_recoveryAttempts=0;}
- if(_recoveryAttempts>=3){self.status=@"Recuperação pausada após três tentativas. Consulte o diagnóstico e reinicie o computador se necessário.";return;}
+ if(_recoveryAttempts>=3){self.status=AthL(@"Recuperação pausada após três tentativas. Consulte o diagnóstico e reinicie o computador se necessário.");return;}
_lastRecovery=now;
kern_return_t r=[self call:AthControl::Restart request:nullptr response:nullptr];
- if(!r){_lastRecovery=now;++_recoveryAttempts;[self closeDriver];self.status=@"Recuperando o driver; aguardando a nova interface…";}
- else self.status=[NSString stringWithFormat:@"Recuperação recusada (0x%x): suspensão, outra sessão ou DMA não liberado. Consulte o diagnóstico.",r];
+ if(!r){_lastRecovery=now;++_recoveryAttempts;[self closeDriver];self.status=AthL(@"Recuperando o driver; aguardando a nova interface…");}
+ else self.status=[NSString stringWithFormat:AthL(@"Recuperação recusada (0x%x): suspensão, outra sessão ou DMA não liberado. Consulte o diagnóstico."),r];
}
-(void)suspend {_sleeping=YES;}
-(void)resume {_sleeping=NO;_retryAt=0;}
@@ -167,27 +168,27 @@
NSDictionary *values=(__bridge_transfer NSDictionary *)properties;
NSNumber *(^number)(NSString *)=^NSNumber *(NSString *key){id value=values[key];return [value isKindOfClass:NSNumber.class]?value:nil;};
if(!number(@"Ath10kQoSEnabled")){_radioDiagnostics=@"";return;}
- NSMutableString *text=[NSMutableString stringWithFormat:@"\nQoS %@ · EDCA contador %@ · atualizações %@\nTX BE/BK/VI/VO %@/%@/%@/%@ · admissão descartada %@",
- number(@"Ath10kQoSEnabled").boolValue?@"ativo":@"legado",number(@"Ath10kWMMParameterCount"),number(@"Ath10kAPMaintenanceCompleted"),
+ NSMutableString *text=[NSMutableString stringWithFormat:AthL(@"\nQoS %@ · EDCA contador %@ · atualizações %@\nTX BE/BK/VI/VO %@/%@/%@/%@ · admissão descartada %@"),
+ number(@"Ath10kQoSEnabled").boolValue?AthL(@"ativo"):AthL(@"legado"),number(@"Ath10kWMMParameterCount"),number(@"Ath10kAPMaintenanceCompleted"),
number(@"Ath10kTXACBE"),number(@"Ath10kTXACBK"),number(@"Ath10kTXACVI"),number(@"Ath10kTXACVO"),number(@"Ath10kTXAdmissionDropped")];
NSNumber *rateAge=number(@"Ath10kLinkRateAgeMs"),*noiseAge=number(@"Ath10kLinkNoiseAgeMs");
if(self.linkUp && number(@"Ath10kLinkRateValid").boolValue && rateAge && rateAge.unsignedLongLongValue<=30000)
- [text appendFormat:@"\nTaxa amostrada TX %.1f / RX %.1f Mb/s · idade %.1f s",number(@"Ath10kLinkTXRateKbps").doubleValue/1000,number(@"Ath10kLinkRXRateKbps").doubleValue/1000,rateAge.doubleValue/1000];
- else [text appendString:@"\nTaxa do firmware indisponível"];
+ [text appendFormat:AthL(@"\nTaxa amostrada TX %.1f / RX %.1f Mb/s · idade %.1f s"),number(@"Ath10kLinkTXRateKbps").doubleValue/1000,number(@"Ath10kLinkRXRateKbps").doubleValue/1000,rateAge.doubleValue/1000];
+ else [text appendString:AthL(@"\nTaxa do firmware indisponível")];
if(self.linkUp && number(@"Ath10kLinkNoiseValid").boolValue && noiseAge && noiseAge.unsignedLongLongValue<=30000)
- [text appendFormat:@" · ruído %d dBm (%.1f s)",static_cast<int32_t>(number(@"Ath10kLinkNoiseDbm").unsignedIntValue),noiseAge.doubleValue/1000];
- else [text appendString:@" · ruído indisponível"];
- [text appendFormat:@"\nPCIe idle %@ · acordar/repousar %@/%@ · falhas %@\nFirmware: estatísticas %@ · formato não interpretado %@ · eventos desconhecidos %@ · RF bloqueado %@",
- number(@"Ath10kPCIeIdleEnabled").boolValue?@"habilitado":@"desativado",number(@"Ath10kPCIeTargetWakes"),number(@"Ath10kPCIeTargetSleeps"),number(@"Ath10kPCIeWakeFailures"),
- number(@"Ath10kFirmwareStatsDecoded"),number(@"Ath10kFirmwareStatsUnsupported"),number(@"Ath10kWMIUnknownEvents"),number(@"Ath10kWMIRFKill").boolValue?@"sim":@"não"];
+ [text appendFormat:AthL(@" · ruído %d dBm (%.1f s)"),static_cast<int32_t>(number(@"Ath10kLinkNoiseDbm").unsignedIntValue),noiseAge.doubleValue/1000];
+ else [text appendString:AthL(@" · ruído indisponível")];
+ [text appendFormat:AthL(@"\nPCIe idle %@ · acordar/repousar %@/%@ · falhas %@\nFirmware: estatísticas %@ · formato não interpretado %@ · eventos desconhecidos %@ · RF bloqueado %@"),
+ number(@"Ath10kPCIeIdleEnabled").boolValue?AthL(@"habilitado"):AthL(@"desativado"),number(@"Ath10kPCIeTargetWakes"),number(@"Ath10kPCIeTargetSleeps"),number(@"Ath10kPCIeWakeFailures"),
+ number(@"Ath10kFirmwareStatsDecoded"),number(@"Ath10kFirmwareStatsUnsupported"),number(@"Ath10kWMIUnknownEvents"),number(@"Ath10kWMIRFKill").boolValue?AthL(@"sim"):AthL(@"não")];
if(number(@"Ath10kWMITemperatureEvents").unsignedIntValue)
- [text appendFormat:@" · temperatura %d °C",static_cast<int32_t>(number(@"Ath10kWMITemperatureCelsius").unsignedIntValue)];
+ [text appendFormat:AthL(@" · temperatura %d °C"),static_cast<int32_t>(number(@"Ath10kWMITemperatureCelsius").unsignedIntValue)];
_radioDiagnostics=text;
}
-(void)tick:(NSTimer *)timer {
(void)timer;if(_sleeping)return;CFTimeInterval now=CFAbsoluteTimeGetCurrent();
if(!_driver){if(now>=_retryAt)[self openDriver];return;}
- AthControl::Response st{};if([self call:AthControl::Status request:nullptr response:&st]){[self closeDriver];self.status=@"Comunicação interrompida. Aguardando o driver…";return;}
+ AthControl::Response st{};if([self call:AthControl::Status request:nullptr response:&st]){[self closeDriver];self.status=AthL(@"Comunicação interrompida. Aguardando o driver…");return;}
self.extensionsAvailable=(st.flags&512)!=0;self.linkUp=(st.flags&4)!=0;self.scanning=(st.flags&256)!=0;
uint32_t infoBits=0;BOOL scanTerminalFailure=NO;AthControl::Response info{};
if(self.extensionsAvailable && ![self call:AthControl::Info request:nullptr response:&info] && info.length>=84){
@@ -198,26 +199,26 @@
if(_scanFreshness.observe(gen,(scanFlags&1)!=0,(scanFlags&2)!=0,(scanFlags&4)!=0)){[self loadRows:st];_generation=gen;++self.scanCompletionSerial;}
self.scanSucceeded=_scanFreshness.valid;scanTerminalFailure=(scanFlags&1) && (scanFlags&6);
self.channel=read32(info.data+8);self.signalDbm=(int32_t)read32(info.data+12);self.channelWidth=read32(info.data+16);self.spatialStreams=read32(info.data+20);infoBits=read32(info.data+28);
- if(self.linkUp && !self.connectedSSID.length && info.data[32]<=32){self.connectedSSID=[[NSString alloc] initWithBytes:info.data+33 length:info.data[32] encoding:NSUTF8StringEncoding]?:@"Rede associada";self.connectedBSSID=macString(st.bssid);}
+ if(self.linkUp && !self.connectedSSID.length && info.data[32]<=32){self.connectedSSID=[[NSString alloc] initWithBytes:info.data+33 length:info.data[32] encoding:NSUTF8StringEncoding]?:AthL(@"Rede associada");self.connectedBSSID=macString(st.bssid);}
char version[17]{};memcpy(version,info.data+68,16);self.driverVersion=[NSString stringWithUTF8String:version]?:@"";
}else if(!_loaded && (st.flags&2)){[self loadRows:st];self.scanSucceeded=YES;++self.scanCompletionSerial;}
if(!self.interfaceName.length && now-_openedAt>1)[self findInterface];
- self.diagnostics=[NSString stringWithFormat:@"App 0.5.3 · ABI %u · Kext %@\nRuntime %@ · Scan %@ (geração %u)\nInterface %@ · Link %@ · Associação %u · Segurança %u\nCanal %ld · largura %ld MHz · NSS %ld · RSSI estimado %ld dBm\nRedes %u · Estado %s",st.version,self.driverVersion,(st.flags&1)?@"ativo":@"parado",self.scanning?@"em curso":(scanTerminalFailure?@"falhou/cancelado":((st.flags&2)?@"concluído":@"inicial")),_generation,self.interfaceName,self.linkUp?@"ativo":@"inativo",st.stage,st.phase,(long)self.channel,(long)self.channelWidth,(long)self.spatialStreams,(long)self.signalDbm,st.count,st.error];
- if(info.length>=108)self.diagnostics=[self.diagnostics stringByAppendingFormat:@"\nEconomia STA %@ · TX %.1f dBm · limite AP %u dB · perdas do AP %u",(read32(info.data+84)&2)?@"ativa":@"desativada",read32(info.data+92)/2.0,read32(info.data+96),read32(info.data+88)];
+ self.diagnostics=[NSString stringWithFormat:AthL(@"App %@ · ABI %u · Kext %@\nRuntime %@ · Scan %@ (geração %u)\nInterface %@ · Link %@ · Associação %u · Segurança %u\nCanal %ld · largura %ld MHz · NSS %ld · RSSI estimado %ld dBm\nRedes %u · Estado %s"),[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] ?: @"—",st.version,self.driverVersion,(st.flags&1)?AthL(@"ativo"):AthL(@"parado"),self.scanning?AthL(@"em curso"):(scanTerminalFailure?AthL(@"falhou/cancelado"):((st.flags&2)?AthL(@"concluído"):AthL(@"inicial"))),_generation,self.interfaceName,self.linkUp?AthL(@"ativo"):AthL(@"inativo"),st.stage,st.phase,(long)self.channel,(long)self.channelWidth,(long)self.spatialStreams,(long)self.signalDbm,st.count,st.error];
+ if(info.length>=108)self.diagnostics=[self.diagnostics stringByAppendingFormat:AthL(@"\nEconomia STA %@ · TX %.1f dBm · limite AP %u dB · perdas do AP %u"),(read32(info.data+84)&2)?AthL(@"ativa"):AthL(@"desativada"),read32(info.data+92)/2.0,read32(info.data+96),read32(info.data+88)];
[self loadRadioDiagnostics:now];if(_radioDiagnostics.length)self.diagnostics=[self.diagnostics stringByAppendingString:_radioDiagnostics];
self.canConnect=self.scanSucceeded&&(st.flags&1)&&(st.flags&2)&&st.stage==0&&!_session&&!self.scanning;
self.canDisconnect=_session && self.linkUp && (!_secure || st.phase==5) && !_disconnecting;self.canCancel=_session&&!_disconnecting;self.editingEnabled=!_session;
if(!(st.flags&1)){
- if(_session){[self clearSession];_failed=YES;}self.status=[NSString stringWithFormat:@"Kext interrompida: %s.",st.error];
+ if(_session){[self clearSession];_failed=YES;}self.status=[NSString stringWithFormat:AthL(@"Kext interrompida: %s."),st.error];
if(self.autoRecover && self.extensionsAvailable && !(infoBits&3))[self recover];return;
}
if(_disconnecting || (_session && st.stage==0)){
if((st.flags&64)||st.stage!=0)return;
- [self clearSession];self.linkUp=NO;self.connectedSSID=@"";self.connectedBSSID=@"";self.status=_failureMessage?:@"Desconectado. A interface está pronta para outra rede.";return;
- }
- if(!_session && scanTerminalFailure){self.status=@"Varredura falhou ou foi cancelada. Atualize para obter uma nova lista de redes.";return;}
- if(!_session){if(!_failed)self.status=self.scanning?@"Pesquisando redes…":((st.flags&2)?@"Selecione uma rede para conectar.":@"Aguardando a varredura inicial…");return;}
- if(!_authorized && now-_connectedAt>25){[self fail:@"A conexão não terminou em 25 segundos. Confira a senha e o sinal; a sessão será liberada."];return;}
+ [self clearSession];self.linkUp=NO;self.connectedSSID=@"";self.connectedBSSID=@"";self.status=_failureMessage?:AthL(@"Desconectado. A interface está pronta para outra rede.");return;
+ }
+ if(!_session && scanTerminalFailure){self.status=AthL(@"Varredura falhou ou foi cancelada. Atualize para obter uma nova lista de redes.");return;}
+ if(!_session){if(!_failed)self.status=self.scanning?AthL(@"Pesquisando redes…"):((st.flags&2)?AthL(@"Selecione uma rede para conectar."):AthL(@"Aguardando a varredura inicial…"));return;}
+ if(!_authorized && now-_connectedAt>25){[self fail:AthL(@"A conexão não terminou em 25 segundos. Confira a senha e o sinal; a sessão será liberada.")];return;}
if(_secure){
if(_candidateAt && now-_candidateAt>5 && _supplicant.pairwisePending()){
_supplicant.cancelPairwiseAttempt();_candidateAt=0;_pendingLength=0;AthSecurity::wipe(_pending,sizeof(_pending));
@@ -226,26 +227,26 @@
if(![self call:AthControl::ReceiveEAPOL request:nullptr response:&rx]){
auto result=_supplicant.receive(rx.data,rx.length);
if(result!=AthSecurity::Supplicant<MacCrypto>::Ignore && !_jobAt)_jobAt=now;
- if(result==AthSecurity::Supplicant<MacCrypto>::Fatal){[self fail:[NSString stringWithUTF8String:_supplicant.error]];return;}
+ if(result==AthSecurity::Supplicant<MacCrypto>::Fatal){[self fail:[NSString stringWithFormat:AthL(@"Falha WPA2: %s."),_supplicant.error]];return;}
if(_supplicant.pairwisePending()&&!_candidateAt)_candidateAt=now;
if(result==AthSecurity::Supplicant<MacCrypto>::Keys || result==AthSecurity::Supplicant<MacCrypto>::GroupKeys || result==AthSecurity::Supplicant<MacCrypto>::PairKeys){
_keyOperation=result==AthSecurity::Supplicant<MacCrypto>::Keys?AthControl::InstallKeys:(result==AthSecurity::Supplicant<MacCrypto>::GroupKeys?AthControl::RekeyGroup:AthControl::RekeyPair);
- if(_keyOperation!=AthControl::InstallKeys&&!self.extensionsAvailable){[self fail:@"A renovação WPA2 exige Ath10kMac 0.0.73." ];return;}
+ if(_keyOperation!=AthControl::InstallKeys&&!self.extensionsAvailable){[self fail:AthL(@"A renovação WPA2 exige Ath10kMac 0.0.73.") ];return;}
memcpy(_pendingKeys,_supplicant.keys,39);AthSecurity::wipe(_supplicant.keys,sizeof(_supplicant.keys));_candidateAt=0;
}
if(result!=AthSecurity::Supplicant<MacCrypto>::Ignore){
- if(_supplicant.outputLength>sizeof(_pending)){[self fail:@"Resposta EAPOL excedeu o limite." ];return;}
+ if(_supplicant.outputLength>sizeof(_pending)){[self fail:AthL(@"Resposta EAPOL excedeu o limite.") ];return;}
memcpy(_pending,_supplicant.output,_supplicant.outputLength);_pendingLength=_supplicant.outputLength;
}
}
}
- if(_jobAt && now-_jobAt>8 && (_pendingLength||_keyOperation)){[self fail:@"A renovação/resposta WPA2 não foi confirmada em oito segundos." ];return;}
+ if(_jobAt && now-_jobAt>8 && (_pendingLength||_keyOperation)){[self fail:AthL(@"A renovação/resposta WPA2 não foi confirmada em oito segundos.") ];return;}
if((_pendingLength||_keyOperation) && self.extensionsAvailable&&!_held){AthControl::Request hold{};hold.index=1;if(![self call:AthControl::SecurityHold request:&hold response:nullptr])_held=YES;}
bool keySubmitted=false;
if(_keyOperation){AthControl::Request keys{};keys.length=39;memcpy(keys.data,_pendingKeys,39);
kern_return_t r=[self call:_keyOperation request:&keys response:nullptr];AthSecurity::wipe(keys.data,sizeof(keys.data));
if(!r){keySubmitted=true;_waitPhase=_keyOperation==AthControl::InstallKeys?3:5;_keyOperation=0;AthSecurity::wipe(_pendingKeys,sizeof(_pendingKeys));}
- else if(r!=kIOReturnBusy&&r!=kIOReturnNotReady){[self fail:@"A kext rejeitou a chave nova. A sessão será encerrada sem reinstalar a chave." ];return;}
+ else if(r!=kIOReturnBusy&&r!=kIOReturnNotReady){[self fail:AthL(@"A kext rejeitou a chave nova. A sessão será encerrada sem reinstalar a chave.") ];return;}
}
// st was read before submitting the key. A rekey starts from phase 5, so
// require a fresh status poll before treating phase 5 as confirmation.
@@ -253,14 +254,14 @@
AthControl::Request tx{};tx.length=(uint32_t)_pendingLength;memcpy(tx.data,_pending,_pendingLength);
kern_return_t r=[self call:AthControl::SendEAPOL request:&tx response:nullptr];
if(!r){if(_waitPhase==3)_m4Sent=YES;_pendingLength=0;_waitPhase=0;AthSecurity::wipe(_pending,sizeof(_pending));}
- else if(r!=kIOReturnBusy&&r!=kIOReturnNotReady){[self fail:@"Falha ao transmitir EAPOL." ];return;}
+ else if(r!=kIOReturnBusy&&r!=kIOReturnNotReady){[self fail:AthL(@"Falha ao transmitir EAPOL.") ];return;}
}
if(!_pendingLength && !_keyOperation)_jobAt=0;
if(_held && !_pendingLength&&!_keyOperation&&!(st.flags&8)){AthControl::Request hold{};[self call:AthControl::SecurityHold request:&hold response:nullptr];_held=NO;}
if(_m4Sent&&!_authorized&&!(st.flags&8)&&st.phase==3){if(![self call:AthControl::Authorize request:nullptr response:nullptr])_authorized=YES;}
}
- if(self.linkUp){_authorized=YES;self.status=@"Associado. Verificando o endereço IP da interface…";}
- else self.status=[NSString stringWithFormat:@"Conectando… associação %u, segurança %u.",st.stage,st.phase];
+ if(self.linkUp){_authorized=YES;self.status=AthL(@"Associado. Verificando o endereço IP da interface…");}
+ else self.status=[NSString stringWithFormat:AthL(@"Conectando… associação %u, segurança %u."),st.stage,st.phase];
}
-(void)shutdown {[_timer invalidate];_timer=nil;if(_session&&self.extensionsAvailable)[self call:AthControl::Cancel request:nullptr response:nullptr];[self closeDriver];}
@end
--- a/Ath10k Connectivity/Driver/AthLocalization.h
+++ b/Ath10k Connectivity/Driver/AthLocalization.h
@@ -0,0 +1,26 @@
+#pragma once
+#import <Foundation/Foundation.h>
+#import <dispatch/dispatch.h>
+
+// The GUI passes its effective language to launchd, so the headless engine
+// produces status/diagnostic text in that same language. No protocol IDs or
+// actual network names are passed through this lookup.
+static inline NSString *AthL(NSString *key) {
+ static NSBundle *stringsBundle;
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ NSBundle *root = [NSBundle mainBundle];
+ NSArray<NSString *> *supported = @[@"en", @"pt-BR", @"es"];
+ NSString *language = [NSProcessInfo processInfo].environment[@"ATH10K_APP_LANGUAGE"];
+ if (![supported containsObject:language]) {
+ language = @"en";
+ for (NSString *candidate in root.preferredLocalizations) {
+ if ([supported containsObject:candidate]) { language = candidate; break; }
+ }
+ }
+ NSString *path = [root pathForResource:language ofType:@"lproj"];
+ stringsBundle = path ? [NSBundle bundleWithPath:path] : root;
+ if (!stringsBundle) stringsBundle = root;
+ });
+ return [stringsBundle localizedStringForKey:key value:nil table:@"Localizable"];
+}
--- a/Ath10k Connectivity/InterfaceStatus.swift
+++ b/Ath10k Connectivity/InterfaceStatus.swift
@@ -57,6 +57,9 @@
case reachable = "Internet verificada pela interface Wi-Fi"
case portal = "Possível portal de autenticação"
case inconclusive = "Teste de Internet inconclusivo"
+
+ // Keep Codable wire values stable; translate only the displayed label.
+ var localizedDescription: String { L10n.text(rawValue) }
}
@MainActor
--- a/Ath10k Connectivity/Localization.swift
+++ b/Ath10k Connectivity/Localization.swift
@@ -0,0 +1,29 @@
+import Foundation
+
+// User-facing strings only. SSIDs, credential identifiers, XPC commands and
+// driver error identifiers retain their original bytes and meaning.
+enum L10n {
+ static let supportedLanguages = ["en", "pt-BR", "es"]
+ static let language: String = {
+ if let inherited = ProcessInfo.processInfo.environment["ATH10K_APP_LANGUAGE"],
+ supportedLanguages.contains(inherited) { return inherited }
+ return Bundle.main.preferredLocalizations.first(where: supportedLanguages.contains) ?? "en"
+ }()
+ private static let resourceBundle = bundle(for: language)
+
+ static func bundle(for language: String, in root: Bundle = .main) -> Bundle {
+ let effective = supportedLanguages.contains(language) ? language : "en"
+ guard let path = root.path(forResource: effective, ofType: "lproj"),
+ let bundle = Bundle(path: path) else { return root }
+ return bundle
+ }
+ static func text(_ key: String, in bundle: Bundle? = nil) -> String {
+ (bundle ?? resourceBundle).localizedString(forKey: key, value: nil, table: "Localizable")
+ }
+ static func format(_ key: String, _ arguments: CVarArg...) -> String {
+ formatted(key, arguments: arguments, in: resourceBundle)
+ }
+ static func formatted(_ key: String, arguments: [CVarArg], in bundle: Bundle) -> String {
+ String(format: text(key, in: bundle), locale: Locale.current, arguments: arguments)
+ }
+}
--- a/Ath10k Connectivity/NetworkModel.swift
+++ b/Ath10k Connectivity/NetworkModel.swift
@@ -15,11 +15,11 @@
let secure: Bool
let supported: Bool
var hidden: Bool = false
- var band: String { channel <= 14 ? "2,4 GHz" : "5 GHz" }
+ var band: String { channel <= 14 ? L10n.text("2,4 GHz") : "5 GHz" }
var dfs: Bool { (52...144).contains(channel) }
var profileID: String { credentialID + (secure ? "|wpa2" : "|open") }
var connectable: Bool { supported && !hidden }
- var signalText: String { signal == Int(Int32.min) ? "Sinal indisponível" : "≈ \(signal) dBm" }
+ var signalText: String { signal == Int(Int32.min) ? L10n.text("Sinal indisponível") : "≈ \(signal) dBm" }
}
@MainActor
@@ -36,7 +36,7 @@
@Published var hiddenSSIDAvailable = false
@Published var powerSaving: Bool { didSet { preferenceChanged() } }
@Published var roaming: Bool { didSet { preferenceChanged() } }
- @Published var status = "Procurando o driver…"
+ @Published var status = L10n.text("Procurando o driver…")
@Published var diagnostics = ""
@Published var canConnect = false
@Published var canDisconnect = false
@@ -88,7 +88,7 @@
}
var connectionSummary: String {
guard linkUp else { return status }
- return addresses.hasAddress ? internet.rawValue : "Associado a \(connectedSSID). Aguardando DHCP/endereço IP…"
+ return addresses.hasAddress ? internet.localizedDescription : L10n.format("Associado a %@. Aguardando DHCP/endereço IP…", connectedSSID)
}
var sortedNetworks: [WiFiNetwork] {
networks.sorted { rank($0) > rank($1) }
@@ -109,7 +109,7 @@
profiles = saved.items
if engine { driver.autoRecover = autoRecover; driver.powerSaving = powerSaving; driver.start() }
else {
- status = "Conectando ao serviço de Wi-Fi…"
+ status = L10n.text("Conectando ao serviço de Wi-Fi…")
agent = ConnectionAgentClient(model: self)
agent?.start()
}
@@ -146,7 +146,7 @@
return WiFiNetwork(id: bssid, index: index.intValue, credentialID: account, name: name, bssid: bssid,
channel: channel.intValue, signal: (row["signal"] as? NSNumber)?.intValue ?? Int(Int32.min),
security: security, secure: secure.boolValue, supported: supported.boolValue,
- hidden: (row["hidden"] as? NSNumber)?.boolValue ?? (name == "Rede oculta"))
+ hidden: (row["hidden"] as? NSNumber)?.boolValue ?? account.isEmpty)
}
if networks != rows { networks = rows; if !rows.contains(where: { $0.id == selection }) { selection = rows.first?.id } }
status = driver.status; diagnostics = driver.diagnostics
@@ -155,7 +155,7 @@
extended = driver.extensionsAvailable; connectedSSID = driver.connectedSSID; connectedBSSID = driver.connectedBSSID
radioOptionsAvailable = driver.radioOptionsAvailable; hiddenSSIDAvailable = driver.hiddenSSIDAvailable
interfaceName = driver.interfaceName; linkUp = driver.linkUp; signal = driver.signalDbm
- radio = "Canal \(driver.channel) · \(driver.channelWidth) MHz · \(driver.spatialStreams) fluxo(s)"
+ radio = L10n.format("Canal %ld · %ld MHz · %ld fluxo(s)", driver.channel, driver.channelWidth, driver.spatialStreams)
if driver.scanCompletionSerial != scanCompletionSerial {
scanCompletionSerial = driver.scanCompletionSerial
if driver.scanSucceeded { lastScan = now }
@@ -170,7 +170,7 @@
saved.remember(network); profiles = saved.items; failures[network.profileID] = nil; pendingNetwork = nil
if let credential = pendingCredential {
pendingCredential = nil
- do { try WiFiKeychain.save(credential.account, password: credential.password); credentialMessage = "Senha salva no Keychain." }
+ do { try WiFiKeychain.save(credential.account, password: credential.password); credentialMessage = L10n.text("Senha salva no Keychain.") }
catch { credentialMessage = error.localizedDescription }
}
}
@@ -259,7 +259,7 @@
do { secret = try WiFiKeychain.read(network.credentialID) ?? "" }
catch { credentialMessage = error.localizedDescription; return }
}
- if network.secure && secret.isEmpty { credentialMessage = "Digite a senha WPA2 desta rede."; return }
+ if network.secure && secret.isEmpty { credentialMessage = L10n.text("Digite a senha WPA2 desta rede."); return }
begin(network, secret: secret, automatic: false)
}
private func begin(_ network: WiFiNetwork, secret: String, automatic: Bool) {
@@ -303,20 +303,20 @@
do {
if profile.secure { try WiFiKeychain.remove(profile.credentialID) }
saved.forget(profile.id); profiles = saved.items; failures[profile.id] = nil; password = ""
- credentialMessage = "Rede e credencial removidas."
+ credentialMessage = L10n.text("Rede e credencial removidas.")
} catch { credentialMessage = error.localizedDescription }
}
func setLogin(_ enabled: Bool) {
do { if enabled { try SMAppService.mainApp.register() } else { try SMAppService.mainApp.unregister() }
startAtLogin = SMAppService.mainApp.status == .enabled
- if enabled && !startAtLogin { credentialMessage = "Autorize o item de início nos Ajustes do Sistema." }
+ if enabled && !startAtLogin { credentialMessage = L10n.text("Autorize o item de início nos Ajustes do Sistema.") }
} catch { credentialMessage = error.localizedDescription }
}
func openPortal() { if let url = URL(string: "http://captive.apple.com/hotspot-detect.html") { NSWorkspace.shared.open(url) } }
func copyDiagnostics() {
NSPasteboard.general.clearContents()
// SSIDs, BSSIDs, IPs and credentials are deliberately omitted from copied diagnostics.
- NSPasteboard.general.setString(diagnostics + "\n" + radio + "\nIP atribuído: \(addresses.hasAddress)\n\(internet.rawValue)", forType: .string)
+ NSPasteboard.general.setString(diagnostics + "\n" + radio + "\n" + L10n.format("IP atribuído: %@", L10n.text(addresses.hasAddress ? "sim" : "não")) + "\n" + internet.localizedDescription, forType: .string)
}
func shutdown() {
updates?.cancel(); updates = nil; probe.cancel()
@@ -361,7 +361,7 @@
let target = network.hidden ? namedHidden(network, name: command.name ?? "") : network
guard !target.hidden || (hiddenSSIDAvailable && (1...32).contains(target.name.utf8.count)) else { return }
let secret = command.password ?? ""
- guard !target.secure || (8...63).contains(secret.utf8.count) else { status = "A senha WPA2 precisa ter 8 a 63 bytes."; return }
+ guard !target.secure || (8...63).contains(secret.utf8.count) else { status = L10n.text("A senha WPA2 precisa ter 8 a 63 bytes."); return }
rememberPassword = command.remember ?? true; begin(target, secret: secret, automatic: false)
case "profile":
if let requested = command.profile, var current = profiles.first(where: { $0.id == requested.id }) {
--- a/Ath10k Connectivity/WiFiKeychain.swift
+++ b/Ath10k Connectivity/WiFiKeychain.swift
@@ -40,6 +40,6 @@
}
private static func failure(_ code: OSStatus) -> NSError {
NSError(domain: NSOSStatusErrorDomain, code: Int(code), userInfo:
- [NSLocalizedDescriptionKey: "Keychain: \(code). Verifique a autorização de acesso do app."])
+ [NSLocalizedDescriptionKey: L10n.format("Keychain: %ld. Verifique a autorização de acesso do app.", Int(code))])
}
}
--- a/Ath10k Connectivity.xcodeproj/project.pbxproj
+++ b/Ath10k Connectivity.xcodeproj/project.pbxproj
@@ -6,7 +6,14 @@
objectVersion = 77;
objects = {
+/* Begin PBXBuildFile section */
+ A10000000000000000000001 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A10000000000000000000006 /* Localizable.strings */; };
+/* End PBXBuildFile section */
+
/* Begin PBXFileReference section */
+ A10000000000000000000002 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
+ A10000000000000000000003 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = "<group>"; };
+ A10000000000000000000004 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
DDFF260D3067928200EE2BA6 /* Ath10k Connectivity.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Ath10k Connectivity.app"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@@ -29,11 +36,18 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ A10000000000000000000005 /* Resources */ = {
+ isa = PBXGroup;
+ children = (A10000000000000000000006 /* Localizable.strings */,);
+ path = Resources;
+ sourceTree = "<group>";
+ };
DDFF26043067928200EE2BA6 = {
isa = PBXGroup;
children = (
DDFF260F3067928200EE2BA6 /* Ath10k Connectivity */,
DDFF260E3067928200EE2BA6 /* Products */,
+ A10000000000000000000005 /* Resources */,
);
sourceTree = "<group>";
};
@@ -71,6 +85,15 @@
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
+
+/* Begin PBXVariantGroup section */
+ A10000000000000000000006 /* Localizable.strings */ = {
+ isa = PBXVariantGroup;
+ children = (A10000000000000000000002 /* en */, A10000000000000000000003 /* pt-BR */, A10000000000000000000004 /* es */,);
+ name = Localizable.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
/* Begin PBXProject section */
DDFF26053067928200EE2BA6 /* Project object */ = {
@@ -91,6 +114,8 @@
knownRegions = (
en,
Base,
+ "pt-BR",
+ es,
);
mainGroup = DDFF26043067928200EE2BA6;
minimizedProjectReferenceProxies = 1;
@@ -109,6 +134,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ A10000000000000000000001 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -251,18 +277,19 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 10;
+ CURRENT_PROJECT_VERSION = 11;
ENABLE_APP_SANDBOX = NO;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_LSUIElement = YES;
+ INFOPLIST_KEY_CFBundleDevelopmentRegion = en;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
- MARKETING_VERSION = 0.5.4;
+ MARKETING_VERSION = 1.0.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
@@ -290,18 +317,19 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 10;
+ CURRENT_PROJECT_VERSION = 11;
ENABLE_APP_SANDBOX = NO;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_LSUIElement = YES;
+ INFOPLIST_KEY_CFBundleDevelopmentRegion = en;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
- MARKETING_VERSION = 0.5.4;
+ MARKETING_VERSION = 1.0.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
--- a/README.en.md
+++ b/README.en.md
@@ -0,0 +1,39 @@
+# Ath10k Connectivity 1.0.0
+
+[Português brasileiro](README.md)
+
+Menu bar app for open and WPA2-Personal/AES networks using Ath10kMac. **Version 1.0.0, build 11**, includes **English, Brazilian Portuguese and Spanish** throughout the window, menu bar, preferences, alerts, connection messages and diagnostics. It follows the macOS application language, with English as fallback.
+
+Ath10kMac remains **0.0.91**, with identical contents. The user reported good QCA6174 throughput and working connectivity after waking the notebook. These hardware results are separate from validation of the localized app.
+
+## Build and install
+
+Requires macOS 13+, Intel x86_64, Python 3 and full Xcode supporting synchronized groups (`objectVersion = 77`). This archive contains sources, without a newly compiled application.
+
+```sh
+./scripts/validate-macos.sh
+./scripts/build-app.sh
+./scripts/install-app.sh
+```
+
+Quit the previous GUI before installing. The installer replaces the app in `/Applications`, stops the old user agent and opens the new app through Launch Services. It restarts Wi-Fi. Run it from your graphical session without sudo. If copying requires authorization, use the Finder alternative in `RELEASE-0.5.4.md` with the new 1.0.0/build 11 product.
+
+Double-click the app normally. Closing the window retains the connection and menu bar item. Quitting the GUI keeps the service running. To stop/remove it, quit the GUI and run `scripts/uninstall-agent.sh`.
+
+## Languages
+
+Use **System Settings → General → Language & Region → Applications** to override the system language. Quit and reopen the GUI after changing it. The effective GUI language is passed to the user agent; a language change recreates the agent and restarts Wi-Fi.
+
+Tables are in `Resources/{en,pt-BR,es}.lproj/Localizable.strings`. Actual SSIDs, BSSIDs, credential identifiers, XPC commands and driver error identifiers retain their original values. Saved profiles and Keychain items keep existing identifiers.
+
+To contribute another language, copy a complete table, preserve printf argument types/order, register it in Xcode and both localization helpers, and run `python3 tests/test_localizations.py`.
+
+## Validation and behavior
+
+Linux checks passed for 145 keys in three tables, lookup coverage, printf compatibility, Codable/XPC values, C/C++ linkage, WPA2 and ScanFreshness with ASan/UBSan, Swift/shell syntax and project structure.
+
+Native Xcode builds and localized GUI behavior remain to be checked on a Mac. `validate-macos.sh` builds Debug/Release, checks signature/version/localized resources and runs Swift and Objective-C tests using the built tables. See `VALIDATION.md` and `RELEASE-1.0.0.md`.
+
+Connection behavior is retained: credentials in the user’s Keychain, saved-network autojoin, DHCP/IPv6 through macOS, WPA2 key renewal in the user agent and fresh association during roaming. Priorities consistently use 0–100, highest first. Diagnostics read the bundle version; rates may be unavailable if the firmware statistics layout is unsupported.
+
+The driver still provides open/WPA2-Personal STA operation. This localization release does not change QCA9377 BMI initialization or add WPA3, Enterprise, mandatory PMF, AP, monitor or P2P.
--- a/README.md
+++ b/README.md
@@ -1,56 +1,53 @@
-# Ath10k Connectivity 0.5.4
+# Ath10k Connectivity 1.0.0
-Corrige a apresentação e a reabertura da GUI pelo Finder e retira o ciclo gráfico do serviço `--agent`. Veja `RELEASE-0.5.4.md`. Preserva a correção de ligação C de `AthAgentPeerTrusted` da 0.5.3.
+[English](README.en.md)
-Aplicativo STA entregue com Ath10kMac 0.0.91, cujo código permanece idêntico ao pacote anterior. O motor de conexão executa em um LaunchAgent da sessão do usuário; a interface gráfica usa XPC. Sair da GUI conserva autenticação WPA2, rekeys, autojoin e recuperação no serviço. Desconectar pelo aplicativo continua pausando autojoin.
+Aplicativo para redes abertas e WPA2-Personal/AES com Ath10kMac. A versão **1.0.0, build 11**, oferece **português brasileiro, inglês e espanhol** na janela, barra de menus, preferências, confirmações, mensagens de conexão, Keychain e diagnóstico. O idioma segue a preferência do aplicativo no macOS; inglês é o fallback.
-## Compilar e usar
+A kext continua na **0.0.91**, com conteúdo idêntico. O usuário confirmou boa velocidade na QCA6174 e funcionamento após o notebook retornar do repouso. Esses resultados de hardware são separados da validação do novo app localizado.
-Requer macOS 13 ou posterior, Intel x86_64, Python 3 para a regressão de ABI e Xcode completo compatível com o projeto de grupos sincronizados (objectVersion 77). Depois de substituir uma versão anterior, use Product → Clean Build Folder no Xcode antes de compilar.
+## Compilar e instalar
+
+Requer macOS 13+, Intel x86_64, Python 3 e Xcode completo compatível com grupos sincronizados (`objectVersion = 77`). Este pacote contém fontes; não inclui um novo `.app` compilado.
```sh
./scripts/validate-macos.sh
./scripts/build-app.sh
```
-Os scripts compilam e assinam localmente o aplicativo com assinatura ad-hoc. O teste de validação confere Debug/Release, concorrência Swift, versão, arquitetura e recursos. Para uso contínuo com Keychain, é recomendável uma identidade de assinatura estável. O aplicativo verifica UID e assinatura/hash do mesmo executável no serviço XPC e no cliente; não use uma compilação sem assinatura.
+A validação compila Debug/Release, verifica versão, assinatura, arquitetura e as três tabelas dentro do produto e executa os testes nativos de localização Swift/Objective-C. O build produz o aplicativo Debug com assinatura ad-hoc.
-Depois de compilar, encerre a GUI anterior com **Sair do Ath10k Connectivity** e execute:
+Encerre a GUI antiga com **Sair do Ath10k Connectivity** antes de atualizar:
```sh
./scripts/install-app.sh
```
-O instalador confere o produto, copia-o para `/Applications`, encerra o job do serviço antigo e abre o novo app por Launch Services. Essa atualização reinicia a conexão Wi-Fi. O serviço 0.5.3 precisa sair da memória para que sua antiga instância gráfica não continue recebendo a ativação do Finder. Depois da instalação, use dois cliques no `.app`; não é necessário executar o binário interno.
+O instalador copia para `/Applications`, encerra o serviço antigo e abre o novo app por Launch Services. A atualização reinicia a conexão. Execute na sessão gráfica do usuário, sem sudo. Se a pasta exigir autorização, use o procedimento pelo Finder em [RELEASE-0.5.4.md](RELEASE-0.5.4.md), com o produto 1.0.0/build 11.
-Se `/Applications` exigir autorização, use o procedimento alternativo com Finder de `RELEASE-0.5.4.md`. O LaunchAgent registra o caminho absoluto do executável. Abra sem sudo. O serviço recebe `--agent`, usa o próprio usuário e possui IOUserClient/supplicant; não há daemon de root. A kext continua instalada pelo procedimento habitual com autorização de administrador.
+Depois, abra o `.app` com dois cliques. A GUI conserva a barra de menus sem ícone no Dock; fechar a janela mantém a conexão. O serviço `--agent` continua mantendo WPA2 quando a GUI é encerrada. Cliente e serviço preservam a validação de UID e assinatura/hash do mesmo executável.
-O primeiro início registra `br.com.jonasw8.ath10k.connectivity.agent` em `~/Library/LaunchAgents`. Ele inicia com a sessão do usuário e continua com a GUI fechada. A preferência Iniciar com a sessão controla a interface gráfica; o motor tem seu registro próprio. Uma atualização do executável substitui a sessão do motor para manter cliente e serviço no mesmo código. Ao mover/atualizar o app, abra novamente para atualizar o registro.
+## Idiomas
-Para encerrar e remover o motor:
+Os recursos ficam em `Resources/en.lproj`, `Resources/pt-BR.lproj` e `Resources/es.lproj`. Para alterar apenas o idioma do app, use **Ajustes do Sistema → Geral → Idioma e Região → Aplicativos**. Encerre e reabra a GUI após a mudança.
-```sh
-./scripts/uninstall-agent.sh
-```
+A GUI envia seu idioma efetivo ao LaunchAgent. Se ele mudar, o serviço é recriado para apresentar os mesmos textos; isso reinicia a conexão. SSIDs reais, BSSIDs, identificadores de credenciais, comandos XPC e códigos técnicos do driver mantêm os valores originais. Senhas e perfis existentes usam as mesmas chaves.
-Feche a GUI antes desse comando, pois uma GUI aberta tenta recuperar o serviço. Uma nova abertura registra o motor novamente. Encerrar o motor fecha a sessão de conexão; não é a mesma operação que fechar a interface gráfica.
+Para contribuir com outro idioma, copie uma tabela completa, preserve tipos e ordem dos argumentos printf e registre o idioma no grupo localizado do Xcode e nos dois helpers. Execute `python3 tests/test_localizations.py`.
## Comportamento
-- Barra de menus e janela para redes, senhas, perfis, busca, diagnóstico e preferências. A GUI apresenta a janela no início e a reabre ao dar dois cliques com ela fechada ou minimizada. Apenas o processo `--agent` em segundo plano não mostra ícone de menu.
-- Motor mantém associação, WPA2-PSK/CCMP, GTK/PTK rekey, scan, reconexão após scan novo, roaming por nova associação, suspensão/despertar e rematching seguro.
-- Perfis ficam nas preferências; senhas no Keychain do usuário. Autojoin só usa redes salvas e credenciais acessíveis sem diálogo. Desconexão/cancelamento manual pausa autojoin até Retomar.
-- SSID oculto, país/canais e economia STA seguem as capacidades do driver. Credencial oculta é vinculada ao SSID real e BSSID conhecido. Roaming pode interromper tráfego.
-- DHCP continua no macOS. Endereços e teste opcional de Internet são vinculados à interface Ath10k; conexão de cabo não comprova Internet Wi-Fi.
-- Copiar diagnóstico omite SSID/BSSID/IP e senhas. O diagnóstico inclui QoS/AC, atualizações EDCA, energia PCIe, eventos e estatísticas do firmware. Taxa TX/RX é amostra, não velocidade de download. Taxa e ruído têm idades separadas e deixam de aparecer depois de 30 segundos. RSSI estimado por SNR −95 continua identificado como estimativa.
-- XPC aceita comandos limitados e snapshots com sequência/época. Interrupção da GUI não encerra o supplicant. O cliente verifica o serviço antes de enviar uma senha; o serviço valida o cliente antes de aceitar comandos.
+- Senhas no Keychain do usuário e perfis nas preferências. Autojoin usa apenas redes salvas e credenciais acessíveis sem diálogo.
+- Prioridades **0–100**, maiores primeiro; em empate, sinal mais forte. Desconectar/cancelar manualmente pausa autojoin até Retomar.
+- DHCP/IPv6 continuam no macOS. A verificação opcional de Internet usa a interface Ath10k.
+- WPA2, rekey, scan, reconexão e roaming continuam no serviço. Roaming faz nova associação; repouso reconecta pelo caminho de reinicialização existente.
+- O serviço permanece em `~/Library/LaunchAgents/br.com.jonasw8.ath10k.connectivity.agent.plist`. Para removê-lo, feche a GUI e execute `./scripts/uninstall-agent.sh`.
+- Copiar diagnóstico omite SSID/BSSID/IP e senhas. A versão vem do bundle. Taxas do firmware são amostras, não velocidade de download; podem ficar indisponíveis se o formato não for decodificado.
-## Validação e limites
+## Validação
-`validation-054-linkage.log`: ligação entre um chamador C e uma definição C++ usando o header de produção. `validation-054-security.log`: supplicant e ScanFreshness com ASan/UBSan. `validation-054-swift-syntax.log`: análise de sintaxe, sem compilação ou checagem de tipos Swift. Scripts conferidos com `sh -n`. A suíte da kext 0.0.91 tem seus próprios registros no pacote; ela não foi executada novamente para esta mudança exclusiva do app.
+Passaram no Linux: 145 chaves em três idiomas, cobertura, formatos printf, valores Codable/XPC, ABI C/C++, WPA2 e ScanFreshness com ASan/UBSan, sintaxe Swift/shell e estrutura Xcode.
-**Ainda não executados neste ambiente Linux:** build Swift/ObjC++, launchd/XPC, assinatura em execução, Keychain, UI e rádio real. Leia `VALIDATION.md` antes de considerar a versão validada no Mac. Os ícones e os headers compartilhados foram preservados.
+Build Xcode, GUI/layout, Finder, launchd/XPC e Keychain do app localizado ainda precisam de validação no Mac. Os testes estão em `validate-macos.sh`; leia [VALIDATION.md](VALIDATION.md) e [RELEASE-1.0.0.md](RELEASE-1.0.0.md). Logs 0.5.x são históricos.
-Perfil: redes abertas e WPA2-Personal/CCMP. Não há WPA3/SAE, Enterprise/EAP, PMF obrigatório, AP/monitor/P2P ou WoWLAN. Repouso reconecta por reinicialização; não preserva associação. A inicialização física da QCA9377 ainda depende de confirmação com as correções e evidências BMI da Ath10kMac 0.0.91.
-
-Para a descrição histórica da 0.5.1 e versões anteriores, consulte `README-HISTORY-0.5.1.md`; aquelas instruções sobre sair do app não descrevem o serviço atual.
+O perfil permanece STA aberto/WPA2-Personal/CCMP. Esta tradução não modifica o bloqueio BMI da QCA9377 nem acrescenta WPA3/Enterprise/PMF, AP, monitor ou P2P.
--- a/RELEASE-1.0.0.md
+++ b/RELEASE-1.0.0.md
@@ -0,0 +1,29 @@
+# Ath10k Connectivity 1.0.0
+
+Changes from 0.5.4:
+
+- Version **1.0.0**, build **11**, in Debug and Release.
+- 145 translated keys in **en**, **pt-BR** and **es**, covering the GUI, menus, saved networks, preferences, confirmations, statuses, Keychain messages and diagnostics.
+- Standard `Localizable.strings` resources explicitly registered in Xcode. English is the development/fallback language. Swift and Objective-C use the same effective app language.
+- The user agent receives the GUI language through its environment. Reopening after a language change updates it as a complete connection epoch. XPC commands, snapshot field names, peer verification and Codable values are retained.
+- Priority UI uses **0–100**, matching the existing agent clamp; negative values are no longer offered.
+- Diagnostic app version is read from `CFBundleShortVersionString`; the fixed `App 0.5.3` label is removed.
+- Catalog coverage/printf checks, native Swift/Objective-C smoke tests and built localized-resource checks are included.
+
+Ath10kMac 0.0.91 and firmware contents remain identical. The user tested good speed and wake from sleep on QCA6174. This release makes no new driver/radio claims.
+
+## Validate on macOS
+
+```sh
+./scripts/validate-macos.sh
+./scripts/build-app.sh
+./scripts/install-app.sh
+```
+
+Quit the old GUI before installing. Installation and effective-language changes restart the service/connection. Open the new app through Finder.
+
+Test each language through macOS per-application language preferences. Check the window, menu bar, saved-network dialogs, scan/connect/disconnect statuses and diagnostics. Verify long English/Spanish text remains legible in the resizable window.
+
+Use an SSID with accents, quotes and percent signs to check literal display and continuity of stored credentials. A successful saved profile should remain usable across language changes. Check the GUI and agent have the same language after reopening.
+
+Catalogs, format arguments, syntax, C ABI and security regressions passed on Linux. Native Swift/ObjC++ builds, localized layout, runtime XPC/Keychain and signature behavior have not run here. Prior kext hardware tests do not replace these app checks.
--- a/Resources/en.lproj/Localizable.strings
+++ b/Resources/en.lproj/Localizable.strings