Skip to content

Commit 6a553db

Browse files
committed
Localize hardcoded About screen labels via String Catalog
1 parent 34698be commit 6a553db

4 files changed

Lines changed: 120 additions & 8 deletions

File tree

SwiftRadio/Config/Config.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,25 @@ struct Config {
6161
struct About {
6262
static let sections: [InfoSection] = [
6363
InfoSection(title: Content.About.Sections.features, items: [
64-
.features()
64+
.features(title: Content.About.Items.features)
6565
]),
6666
InfoSection(title: Content.About.Sections.contact, items: [
67-
.email(address: Config.email),
67+
.email(title: Content.About.Items.email, address: Config.email),
6868
.link(title: Content.About.feedback.0, subtitle: Content.About.feedback.1, url: Config.feedbackURL)
6969
]),
7070
InfoSection(title: Content.About.Sections.support, items: [
71-
.rateApp(appID: "YOUR_APP_ID"),
72-
.share(text: Content.About.shareText)
71+
.rateApp(title: Content.About.Items.rateApp, appID: "YOUR_APP_ID"),
72+
.share(title: Content.About.Items.shareApp, text: Content.About.shareText)
7373
]),
7474
InfoSection(title: Content.About.Sections.credits, items: [
75-
.libraries(),
76-
.credits(owner: "analogcode", repo: "Swift-Radio-Pro")
75+
.libraries(title: Content.About.Items.libraries),
76+
.credits(title: Content.About.Items.contributors, subtitle: Content.About.Items.specialThanks, owner: "analogcode", repo: "Swift-Radio-Pro")
7777
]),
7878
InfoSection(title: Content.About.Sections.legal, items: [
7979
.link(title: Content.About.license.0, subtitle: Content.About.license.1, url: Config.licenseURL)
8080
]),
8181
InfoSection(title: Content.About.Sections.version, items: [
82-
.version()
82+
.version(title: Content.About.Items.appVersion)
8383
])
8484
]
8585
}

SwiftRadio/Config/Content.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,22 @@ struct Content {
2727
static let version = String(localized: "about.sections.version")
2828
}
2929

30+
static let copyright = String(localized: "about.copyright")
31+
3032
static let feedback = (String(localized: "about.feedback.title"), String(localized: "about.feedback.message"))
3133
static let shareText = String(localized: "about.shareText")
3234
static let license = (String(localized: "about.license.title"), String(localized: "about.license.detail"))
35+
36+
struct Items {
37+
static let features = String(localized: "about.items.features")
38+
static let email = String(localized: "about.items.email")
39+
static let rateApp = String(localized: "about.items.rateApp")
40+
static let shareApp = String(localized: "about.items.shareApp")
41+
static let libraries = String(localized: "about.items.libraries")
42+
static let contributors = String(localized: "about.items.contributors")
43+
static let specialThanks = String(localized: "about.items.specialThanks")
44+
static let appVersion = String(localized: "about.items.appVersion")
45+
}
3346
}
3447

3548
struct Contributors {

SwiftRadio/Localizable.xcstrings

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@
2323
}
2424
}
2525
},
26+
"about.copyright" : {
27+
"extractionState" : "manual",
28+
"localizations" : {
29+
"en" : {
30+
"stringUnit" : {
31+
"state" : "translated",
32+
"value" : "Copyright"
33+
}
34+
}
35+
}
36+
},
2637
"about.footerAuthors" : {
2738
"extractionState" : "manual",
2839
"localizations" : {
@@ -45,6 +56,94 @@
4556
}
4657
}
4758
},
59+
"about.items.appVersion" : {
60+
"extractionState" : "manual",
61+
"localizations" : {
62+
"en" : {
63+
"stringUnit" : {
64+
"state" : "translated",
65+
"value" : "App Version"
66+
}
67+
}
68+
}
69+
},
70+
"about.items.contributors" : {
71+
"extractionState" : "manual",
72+
"localizations" : {
73+
"en" : {
74+
"stringUnit" : {
75+
"state" : "translated",
76+
"value" : "Contributors"
77+
}
78+
}
79+
}
80+
},
81+
"about.items.email" : {
82+
"extractionState" : "manual",
83+
"localizations" : {
84+
"en" : {
85+
"stringUnit" : {
86+
"state" : "translated",
87+
"value" : "Email"
88+
}
89+
}
90+
}
91+
},
92+
"about.items.features" : {
93+
"extractionState" : "manual",
94+
"localizations" : {
95+
"en" : {
96+
"stringUnit" : {
97+
"state" : "translated",
98+
"value" : "Features"
99+
}
100+
}
101+
}
102+
},
103+
"about.items.libraries" : {
104+
"extractionState" : "manual",
105+
"localizations" : {
106+
"en" : {
107+
"stringUnit" : {
108+
"state" : "translated",
109+
"value" : "Open Source Libraries"
110+
}
111+
}
112+
}
113+
},
114+
"about.items.rateApp" : {
115+
"extractionState" : "manual",
116+
"localizations" : {
117+
"en" : {
118+
"stringUnit" : {
119+
"state" : "translated",
120+
"value" : "Rate the App"
121+
}
122+
}
123+
}
124+
},
125+
"about.items.shareApp" : {
126+
"extractionState" : "manual",
127+
"localizations" : {
128+
"en" : {
129+
"stringUnit" : {
130+
"state" : "translated",
131+
"value" : "Share the App"
132+
}
133+
}
134+
}
135+
},
136+
"about.items.specialThanks" : {
137+
"extractionState" : "manual",
138+
"localizations" : {
139+
"en" : {
140+
"stringUnit" : {
141+
"state" : "translated",
142+
"value" : "Special Thanks"
143+
}
144+
}
145+
}
146+
},
48147
"about.headerText" : {
49148
"extractionState" : "manual",
50149
"localizations" : {

SwiftRadio/ViewControllers/AboutViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class AboutViewController: UITableViewController {
186186
footerLabel.text =
187187
"""
188188
\(Content.About.footerAuthors)
189-
Copyright © \(Calendar.current.component(.year, from: Date())) \(Content.About.footerCopyright)
189+
\(Content.About.copyright) © \(Calendar.current.component(.year, from: Date())) \(Content.About.footerCopyright)
190190
"""
191191

192192
stackView.addArrangedSubview(logoImageView)

0 commit comments

Comments
 (0)