diff Simoleon/Settings.swift @ 29:c52966834f83

Add localised strings
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Thu, 22 Jul 2021 22:30:54 +0100
parents 4f862c618b44
children 41a905e591e4
line wrap: on
line diff
--- a/Simoleon/Settings.swift	Thu Jul 22 19:06:01 2021 +0100
+++ b/Simoleon/Settings.swift	Thu Jul 22 22:30:54 2021 +0100
@@ -20,21 +20,24 @@
     
     var body: some View {
         List {
-            Section(header: Text("Subscription")) {
-                NavigationLink("Information", destination: SubscriberInfo())
-                if !subscriptionController.isActive {
-                    Text("Subscribe")
+            Section(header: Text("Subscription", comment: "Section header in settings")) {
+                if subscriptionController.isActive {
+                    NavigationLink(destination: SubscriberInfo()) {
+                        Text("Information", comment: "Button to show subscription information in settings")
+                    }
+                } else {
+                    Text("Subscribe", comment: "Button to suscribe in settings")
                         .onTapGesture { showingSubscriptionPaywall = true }
                 }
             }
             
-            Section(header: Text("Preferences")) {
+            Section(header: Text("Preferences", comment: "Section header in settings")) {
                 if subscriptionController.isActive {
-                    Picker("Default currency", selection: $selectedDefaultCurrency) {
+                    Picker(selection: $selectedDefaultCurrency, label: Text("Default currency", comment: "Picker to select default currency"), content: {
                         ForEach(currencyPairs.sorted(), id: \.self) { currencyPair in
                             Text(currencyPair)
                         }
-                    }
+                    })
                 } else {
                     LockedCurrencyPicker()
                         .contentShape(Rectangle())
@@ -42,14 +45,14 @@
                 }
             }
             
-            Section(header: Text("Stay in touch")) {
+            Section(header: Text("Stay in touch", comment: "Section header in settings")) {
                 Link(destination: URL(string: "https://itunes.apple.com/app/id1576390953?action=write-review")!) {
                     HStack {
                         Image(systemName: "heart.fill")
                             .foregroundColor(Color(.systemRed))
                             .imageScale(.large)
                         
-                        Text("Rate Simoleon")
+                        Text("Rate Simoleon", comment: "Button to rate app in Settings")
                     }
                 }
                 
@@ -59,7 +62,7 @@
                             .resizable()
                             .frame(width: 30, height: 30)
                         
-                        Text("Developer's Twitter")
+                        Text("Developer's Twitter", comment: "Button to go to Twitter in Settings")
                     }
                 }
                 
@@ -69,19 +72,24 @@
                             .renderingMode(.original)
                             .imageScale(.large)
                         
-                        Text("Contact")
+                        Text("Contact", comment: "Button to contact in Settings")
                     }
                 }
             }
             
             Section(header: Text("About")) {
-                Link("Website", destination: URL(string: "https://dennistech.io")!)
-                Link("Privacy Policy", destination: URL(string: "https://dennistech.io")!)
+                Link(destination: URL(string: "https://dennistech.io")!) {
+                    Text("Website", comment: "Button to go to Dennis Tech website")
+                }
+                
+                Link(destination: URL(string: "https://dennistech.io")!) {
+                    Text("Privacy Policy", comment: "Button to go to app privacy policy")
+                }
             }
         }
         .onAppear(perform: onAppear)
         .listStyle(InsetGroupedListStyle())
-        .navigationTitle("Settings")
+        .navigationTitle(Text("Settings", comment: "Navigation title"))
         .sheet(isPresented: $showingSubscriptionPaywall) {
             Subscription(showingSubscriptionPaywall: $showingSubscriptionPaywall)
                 .environmentObject(subscriptionController)