Skip to content

Commit

Permalink
Upgrade to String catalougs
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Nov 1, 2023
1 parent 4b7cc42 commit 7abe56a
Show file tree
Hide file tree
Showing 16 changed files with 266 additions and 112 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version:5.9

//
// This source file is part of the Stanford Spezi open-source project
Expand All @@ -15,7 +15,7 @@ let package = Package(
name: "SpeziViews",
defaultLocalization: "en",
platforms: [
.iOS(.v16)
.iOS(.v17)
],
products: [
.library(name: "SpeziViews", targets: ["SpeziViews"])
Expand Down
2 changes: 1 addition & 1 deletion Sources/SpeziViews/Model/ViewState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extension ViewState {

return errorTitle
default:
return String(localized: "VIEW_STATE_DEFAULT_ERROR_TITLE", bundle: .module)
return String(localized: "Error", bundle: .module, comment: "View State default error title")
}
}

Expand Down
155 changes: 155 additions & 0 deletions Sources/SpeziViews/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"sourceLanguage" : "en",
"strings" : {
"DEFAULT_ERROR_DESCRIPTION" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ein unerwarteter Fehler ist aufgetreten!"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Unexpected error occurred!"
}
}
}
},
"Enter your first name ..." : {
"comment" : "Given name placeholder",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Vornamen eingeben ..."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Enter your first name ..."
}
}
}
},
"Enter your last name ..." : {
"comment" : "Family name placeholder",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Familienname eingeben ..."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Enter your last name ..."
}
}
}
},
"Error" : {
"comment" : "View State default error title",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Fehler"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Error"
}
}
}
},
"First Name" : {
"comment" : "Given name title",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Vorname"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "First Name"
}
}
}
},
"Last Name" : {
"comment" : "Family name title",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Familienname"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Last Name"
}
}
}
},
"MARKDOWN_LOADING_ERROR" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Das Dokument konnte nicht geladen werden."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Could not load and parse the document."
}
}
}
},
"MARKDOWN_LOADING_ERROR_FAILURE_REASON" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Der Inhalt des Dokuments konnte nicht verarbeitet werden. Grund dessen ist ein invaliden Markdown Text."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "The system wasn't able to parse the given markdown text, indicating an invalid markdown text."
}
}
}
},
"MARKDOWN_LOADING_ERROR_RECOVERY_SUGGESTION" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bitte prüfen Sie den Inhalt des Markdown Dokuments."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Please check the content of the markdown text."
}
}
}
}
},
"version" : "1.0"
}
27 changes: 0 additions & 27 deletions Sources/SpeziViews/Resources/de.lproj/Localizable.strings

This file was deleted.

27 changes: 0 additions & 27 deletions Sources/SpeziViews/Resources/en.lproj/Localizable.strings

This file was deleted.

4 changes: 2 additions & 2 deletions Sources/SpeziViews/Views/Button/AsyncButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public struct AsyncButton<Label: View>: View {
action: @escaping () async throws -> Void
) where Label == Text {
self.init(role: role, state: state, action: action) {
Text(title)
Text(verbatim: String(title))
}
}

Expand Down Expand Up @@ -211,7 +211,7 @@ public struct AsyncButton<Label: View>: View {
#if DEBUG
struct AsyncThrowingButton_Previews: PreviewProvider {
struct PreviewButton: View {
var title: LocalizedStringResource = "Test Button"
var title: String = "Test Button"
var role: ButtonRole?
var duration: Duration = .seconds(1)
var action: () async throws -> Void = {}
Expand Down
20 changes: 10 additions & 10 deletions Sources/SpeziViews/Views/DescriptionGridRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,34 @@ struct DescriptionGridRow_Previews: PreviewProvider {
Form {
Grid(horizontalSpacing: 8, verticalSpacing: 8) {
DescriptionGridRow {
Text("Description")
Text(verbatim: "Description")
} content: {
Text("Content")
Text(verbatim: "Content")
}
Divider()
DescriptionGridRow {
Text("Description")
Text(verbatim: "Description")
} content: {
Text("Content")
Text(verbatim: "Content")
}
DescriptionGridRow {
Text("Description")
Text(verbatim: "Description")
} content: {
Text("Content")
Text(verbatim: "Content")
}
}
}
Grid(horizontalSpacing: 8, verticalSpacing: 8) {
DescriptionGridRow {
Text("Description")
Text(verbatim: "Description")
} content: {
Text("Content")
Text(verbatim: "Content")
}
Divider()
DescriptionGridRow {
Text("Description")
Text(verbatim: "Description")
} content: {
Text("Content")
Text(verbatim: "Content")
}
}
.padding(32)
Expand Down
4 changes: 2 additions & 2 deletions Sources/SpeziViews/Views/Drawing/CanvasView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SwiftUI


private struct _CanvasView: UIViewRepresentable {
class Coordinator: NSObject, ObservableObject, PKCanvasViewDelegate {
class Coordinator: NSObject, PKCanvasViewDelegate {
let canvasView: _CanvasView


Expand Down Expand Up @@ -178,7 +178,7 @@ struct SignatureView_Previews: PreviewProvider {

static var previews: some View {
VStack {
Text("\(isDrawing.description)")
Text(verbatim: "\(isDrawing.description)")
CanvasView(isDrawing: $isDrawing)
}
}
Expand Down
Loading

0 comments on commit 7abe56a

Please sign in to comment.