Skip to content

Commit a00dae9

Browse files
committed
Create an extension for hiding strings from localizations.
1 parent ab1ebe0 commit a00dae9

7 files changed

Lines changed: 30 additions & 10 deletions

File tree

Xcodes.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
B0C6AD042AD6E65700E64698 /* ReleaseDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */; };
2626
B0C6AD0B2AD9178E00E64698 /* IdenticalBuildView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */; };
2727
B0C6AD0D2AD91D7900E64698 /* IconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD0C2AD91D7900E64698 /* IconView.swift */; };
28+
C02500722B5B7F7300E826A1 /* String+.swift in Sources */ = {isa = PBXBuildFile; fileRef = C02500712B5B7F7300E826A1 /* String+.swift */; };
2829
CA11E7BA2598476C00D2EE1C /* XcodeCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA11E7B92598476C00D2EE1C /* XcodeCommands.swift */; };
2930
CA2518EC25A7FF2B00F08414 /* AppStateUpdateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA2518EB25A7FF2B00F08414 /* AppStateUpdateTests.swift */; };
3031
CA25192A25A9644800F08414 /* XcodeInstallState.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA25192925A9644800F08414 /* XcodeInstallState.swift */; };
@@ -209,6 +210,7 @@
209210
B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReleaseDateView.swift; sourceTree = "<group>"; };
210211
B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdenticalBuildView.swift; sourceTree = "<group>"; };
211212
B0C6AD0C2AD91D7900E64698 /* IconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconView.swift; sourceTree = "<group>"; };
213+
C02500712B5B7F7300E826A1 /* String+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+.swift"; sourceTree = "<group>"; };
212214
CA11E7B92598476C00D2EE1C /* XcodeCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XcodeCommands.swift; sourceTree = "<group>"; };
213215
CA2518EB25A7FF2B00F08414 /* AppStateUpdateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStateUpdateTests.swift; sourceTree = "<group>"; };
214216
CA25192925A9644800F08414 /* XcodeInstallState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XcodeInstallState.swift; sourceTree = "<group>"; };
@@ -380,6 +382,7 @@
380382
536CFDD3263C9A8000026CE0 /* XcodesSheet.swift */,
381383
53CBAB2B263DCC9100410495 /* XcodesAlert.swift */,
382384
E84B7D0C2B296A8900DBDA2B /* NavigationSplitViewWrapper.swift */,
385+
C02500712B5B7F7300E826A1 /* String+.swift */,
383386
);
384387
path = Common;
385388
sourceTree = "<group>";
@@ -886,6 +889,7 @@
886889
CA9FF8662595130600E47BAF /* View+IsHidden.swift in Sources */,
887890
CAE4248C259A68B800B8B246 /* Optional+IsNotNil.swift in Sources */,
888891
B0C6AD0D2AD91D7900E64698 /* IconView.swift in Sources */,
892+
C02500722B5B7F7300E826A1 /* String+.swift in Sources */,
889893
CA9FF9362595B44700E47BAF /* HelperClient.swift in Sources */,
890894
B0C6AD042AD6E65700E64698 /* ReleaseDateView.swift in Sources */,
891895
CAA8587C25A2B37900ACF8C0 /* IsTesting.swift in Sources */,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// String+.swift
3+
// Xcodes
4+
//
5+
// Created by Jinyu Meng on 2024/01/20.
6+
// Copyright © 2024 Robots and Pencils. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
extension String {
12+
// Declare String as String explicitly. Prevent it from being recognized as a LocalizedStringKey.
13+
var hideInLocalizations: String {
14+
return String(self)
15+
}
16+
}

Xcodes/Frontend/InfoPane/CornerRadiusModifier.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extension View {
2929
struct Previews_CornerRadius_Previews: PreviewProvider {
3030
static var previews: some View {
3131
HStack {
32-
Text("XCODES RULES!")
32+
Text("XCODES RULES!".hideInLocalizations)
3333
}.xcodesBackground()
3434
}
3535
}

Xcodes/Frontend/InfoPane/IdenticalBuildView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct IdenticalBuildsView: View {
2929
.font(.headline)
3030

3131
ForEach(builds, id: \.description) { version in
32-
Text("\(version.appleDescription)")
32+
Text("\(version.appleDescription)".hideInLocalizations)
3333
.font(.subheadline)
3434
}
3535
}

Xcodes/Frontend/Preferences/AdvancedPreferencePane.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct AdvancedPreferencePane: View {
8080

8181
GroupBox(label: Text("Active/Select")) {
8282
VStack(alignment: .leading) {
83-
Picker("OnSelect", selection: $appState.onSelectActionType) {
83+
Picker("OnSelect".hideInLocalizations, selection: $appState.onSelectActionType) {
8484

8585
Text(SelectedActionType.none.description)
8686
.tag(SelectedActionType.none)

Xcodes/Frontend/SignIn/SignInCredentialsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct SignInCredentialsView: View {
1313
HStack {
1414
Text("AppleID")
1515
.frame(minWidth: 100, alignment: .trailing)
16-
TextField("example@icloud.com", text: $username)
16+
TextField("example@icloud.com".hideInLocalizations, text: $username)
1717
}
1818
HStack {
1919
Text("Password")

Xcodes/Frontend/XcodeList/AppStoreButtonStyle.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,33 +97,33 @@ struct AppStoreButtonStyle_Previews: PreviewProvider {
9797
Group {
9898
ForEach([ColorScheme.light, .dark], id: \.self) { colorScheme in
9999
Group {
100-
Button("OPEN", action: {})
100+
Button("OPEN".hideInLocalizations, action: {})
101101
.buttonStyle(AppStoreButtonStyle(primary: true, highlighted: false))
102102
.padding()
103103
.background(Color(.textBackgroundColor))
104104
.previewDisplayName("Primary")
105-
Button("OPEN", action: {})
105+
Button("OPEN".hideInLocalizations, action: {})
106106
.buttonStyle(AppStoreButtonStyle(primary: true, highlighted: true))
107107
.padding()
108108
.background(Color(.controlAccentColor))
109109
.previewDisplayName("Primary, Highlighted")
110-
Button("OPEN", action: {})
110+
Button("OPEN".hideInLocalizations, action: {})
111111
.buttonStyle(AppStoreButtonStyle(primary: true, highlighted: false))
112112
.padding()
113113
.disabled(true)
114114
.background(Color(.textBackgroundColor))
115115
.previewDisplayName("Primary, Disabled")
116-
Button("INSTALL", action: {})
116+
Button("INSTALL".hideInLocalizations, action: {})
117117
.buttonStyle(AppStoreButtonStyle(primary: false, highlighted: false))
118118
.padding()
119119
.background(Color(.textBackgroundColor))
120120
.previewDisplayName("Secondary")
121-
Button("INSTALL", action: {})
121+
Button("INSTALL".hideInLocalizations, action: {})
122122
.buttonStyle(AppStoreButtonStyle(primary: false, highlighted: true))
123123
.padding()
124124
.background(Color(.controlAccentColor))
125125
.previewDisplayName("Secondary, Highlighted")
126-
Button("INSTALL", action: {})
126+
Button("INSTALL".hideInLocalizations, action: {})
127127
.buttonStyle(AppStoreButtonStyle(primary: false, highlighted: false))
128128
.padding()
129129
.disabled(true)

0 commit comments

Comments
 (0)