Files
RouterOS/RouterOSAssistant/App/RouterOSAssistantApp.swift
T
KayandClaude Sonnet 5 0d16d05cb3 M16: Zweisprachigkeit (DE/EN) im Experte-Tab, eigener L10n-Helfer statt String Catalog
.environment(\.locale) + Localizable.xcstrings schaltete Text(LocalizedStringKey)
live nachweislich nicht um. Ersetzt durch Core/Localization/L10n.swift
(Dictionary-Lookup je AppStorage("appLanguage")), Umschalt-Button in der Toolbar.
Vollständig übersetzt: alle Tab-Namen, alle Menü-Kategorien, kompletter
Experte-Tab inkl. Firewall-Formulare. 60 Tests grün, live bestätigt.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YDmUd93KxsYGr2kLTotWnG
2026-09-15 15:54:26 +02:00

43 lines
2.2 KiB
Swift

import SwiftUI
@main
struct RouterOSAssistantApp: App {
@StateObject private var connectionService = ConnectionService()
/// Manual language override — independent of the system locale, per the user's explicit
/// request for an in-app toggle button. `.environment(\.locale, ...)` does NOT make
/// `Text(LocalizedStringKey)` re-resolve against Localizable.xcstrings at runtime (confirmed
/// live: toggling had no visible effect), so views read this same AppStorage key directly and
/// translate via `L10n.t(_:_:)` instead.
@AppStorage("appLanguage") private var appLanguage: String = "de"
var body: some Scene {
WindowGroup {
TabView {
ConnectView(connectionService: connectionService)
.tabItem { Label(L10n.t("Verbinden", appLanguage), systemImage: "network") }
SetupView(connectionService: connectionService)
.tabItem { Label(L10n.t("Einrichten", appLanguage), systemImage: "checklist") }
OverviewView(connectionService: connectionService)
.tabItem { Label(L10n.t("Übersicht", appLanguage), systemImage: "point.3.connected.trianglepath.dotted") }
DevicesView(connectionService: connectionService)
.tabItem { Label(L10n.t("Geräte", appLanguage), systemImage: "laptopcomputer.and.iphone") }
ExpertView(connectionService: connectionService)
.tabItem { Label(L10n.t("Experte", appLanguage), systemImage: "wrench.and.screwdriver") }
BackupListView(connectionService: connectionService)
.tabItem { Label(L10n.t("Sicherungen", appLanguage), systemImage: "clock.arrow.circlepath") }
}
.toolbar {
ToolbarItem {
Button {
appLanguage = (appLanguage == "de") ? "en" : "de"
} label: {
Text(appLanguage == "de" ? "EN" : "DE")
}
.help(appLanguage == "de" ? "Switch to English" : "Auf Deutsch umschalten")
}
}
}
.environment(\.locale, Locale(identifier: appLanguage))
}
}