From 6d9d9e9e25404cd300a6be96ae5c957c2a0d7bce Mon Sep 17 00:00:00 2001 From: Constantin Clerc Date: Mon, 15 Jan 2024 00:14:13 +0100 Subject: [PATCH] Release 1.0.1 --- Geranium.xcodeproj/project.pbxproj | 4 +- Geranium/SettingsView.swift | 48 +++++++++++++++++++++ Geranium/Translations/Localizable.xcstrings | 9 ++++ 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/Geranium.xcodeproj/project.pbxproj b/Geranium.xcodeproj/project.pbxproj index 56d536c..7e31a23 100644 --- a/Geranium.xcodeproj/project.pbxproj +++ b/Geranium.xcodeproj/project.pbxproj @@ -873,7 +873,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.1; PRODUCT_BUNDLE_IDENTIFIER = live.cclerc.geranium; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -911,7 +911,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.1; PRODUCT_BUNDLE_IDENTIFIER = live.cclerc.geranium; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/Geranium/SettingsView.swift b/Geranium/SettingsView.swift index 0132f19..ec644a4 100644 --- a/Geranium/SettingsView.swift +++ b/Geranium/SettingsView.swift @@ -11,7 +11,41 @@ struct SettingsView: View { @State var DebugStuff: Bool = false @State var MinimCal: String = "" @State var LocSimTries: String = "" + @State var localisation: String = { + if let languages = UserDefaults.standard.array(forKey: "AppleLanguages") as? [String], + let firstLanguage = languages.first { + return firstLanguage + } else { + return Locale.current.languageCode ?? "en" + } + }() @StateObject private var appSettings = AppSettings() + + let languageMapping: [String: String] = [ + // i made catgpt work for me on this one + "ca": "Catalan", + "cs": "Czech", + "de": "German", + "el": "Greek", + "en": "English", + "es": "Spanish", + "es-419": "Spanish (Latin America)", + "fi": "Finnish", + "fr": "French", + "it": "Italian", + "ja": "Japanese", + "ko": "Korean", + "ru": "Russian", + "sk": "Slovak", + "sr": "Serbian", + "sv": "Swedish", + "vi": "Vietnamese", + "zh-Hans": "Chinese (Simplified)", + "zh-Hant": "Chinese (Traditional)", + ] + var sortedLocalisalist: [String] { + Bundle.main.localizations.sorted() + } var body: some View { NavigationView { List { @@ -23,6 +57,20 @@ struct SettingsView: View { } } + Section(header: Label("App Language", systemImage: "magnifyingglass"), footer: Text("Here you can choose in what language you want the app to be. The app will automatically exit to apply changes ; feel free to launch it again.")) { + Picker("Language", selection: $localisation) { + ForEach(sortedLocalisalist, id: \.self) { abbreviation in + Text(languageMapping[abbreviation] ?? abbreviation) + .tag(abbreviation) + } + } + .onChange(of: localisation) { newValue in + UserDefaults.standard.set([newValue], forKey: "AppleLanguages") + exitGracefully() + } + } + + Section(header: Label("Debug Stuff", systemImage: "chevron.left.forwardslash.chevron.right"), footer: Text("This setting allows you to see experimental values from some app variables.")) { Toggle(isOn: $DebugStuff) { Text("Debug Info") diff --git a/Geranium/Translations/Localizable.xcstrings b/Geranium/Translations/Localizable.xcstrings index 847f3cd..d1626f4 100644 --- a/Geranium/Translations/Localizable.xcstrings +++ b/Geranium/Translations/Localizable.xcstrings @@ -642,6 +642,9 @@ } } } + }, + "App Language" : { + }, "Apps Leftover Caches" : { "localizations" : { @@ -3545,6 +3548,9 @@ } } } + }, + "Here you can choose in what language you want the app to be. The app will automatically exit to apply changes ; feel free to launch it again." : { + }, "Hi ! SE 1 User" : { "localizations" : { @@ -4227,6 +4233,9 @@ } } } + }, + "Language" : { + }, "Latitude: %lf Longitude: %lf" : { "localizations" : {