mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Create an extension for hiding strings from localizations.
This commit is contained in:
parent
ab1ebe016f
commit
a00dae9b0a
7 changed files with 30 additions and 10 deletions
|
|
@ -25,6 +25,7 @@
|
|||
B0C6AD042AD6E65700E64698 /* ReleaseDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */; };
|
||||
B0C6AD0B2AD9178E00E64698 /* IdenticalBuildView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */; };
|
||||
B0C6AD0D2AD91D7900E64698 /* IconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD0C2AD91D7900E64698 /* IconView.swift */; };
|
||||
C02500722B5B7F7300E826A1 /* String+.swift in Sources */ = {isa = PBXBuildFile; fileRef = C02500712B5B7F7300E826A1 /* String+.swift */; };
|
||||
CA11E7BA2598476C00D2EE1C /* XcodeCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA11E7B92598476C00D2EE1C /* XcodeCommands.swift */; };
|
||||
CA2518EC25A7FF2B00F08414 /* AppStateUpdateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA2518EB25A7FF2B00F08414 /* AppStateUpdateTests.swift */; };
|
||||
CA25192A25A9644800F08414 /* XcodeInstallState.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA25192925A9644800F08414 /* XcodeInstallState.swift */; };
|
||||
|
|
@ -209,6 +210,7 @@
|
|||
B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReleaseDateView.swift; sourceTree = "<group>"; };
|
||||
B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdenticalBuildView.swift; sourceTree = "<group>"; };
|
||||
B0C6AD0C2AD91D7900E64698 /* IconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconView.swift; sourceTree = "<group>"; };
|
||||
C02500712B5B7F7300E826A1 /* String+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+.swift"; sourceTree = "<group>"; };
|
||||
CA11E7B92598476C00D2EE1C /* XcodeCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XcodeCommands.swift; sourceTree = "<group>"; };
|
||||
CA2518EB25A7FF2B00F08414 /* AppStateUpdateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStateUpdateTests.swift; sourceTree = "<group>"; };
|
||||
CA25192925A9644800F08414 /* XcodeInstallState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XcodeInstallState.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -380,6 +382,7 @@
|
|||
536CFDD3263C9A8000026CE0 /* XcodesSheet.swift */,
|
||||
53CBAB2B263DCC9100410495 /* XcodesAlert.swift */,
|
||||
E84B7D0C2B296A8900DBDA2B /* NavigationSplitViewWrapper.swift */,
|
||||
C02500712B5B7F7300E826A1 /* String+.swift */,
|
||||
);
|
||||
path = Common;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -886,6 +889,7 @@
|
|||
CA9FF8662595130600E47BAF /* View+IsHidden.swift in Sources */,
|
||||
CAE4248C259A68B800B8B246 /* Optional+IsNotNil.swift in Sources */,
|
||||
B0C6AD0D2AD91D7900E64698 /* IconView.swift in Sources */,
|
||||
C02500722B5B7F7300E826A1 /* String+.swift in Sources */,
|
||||
CA9FF9362595B44700E47BAF /* HelperClient.swift in Sources */,
|
||||
B0C6AD042AD6E65700E64698 /* ReleaseDateView.swift in Sources */,
|
||||
CAA8587C25A2B37900ACF8C0 /* IsTesting.swift in Sources */,
|
||||
|
|
|
|||
16
Xcodes/Frontend/Common/String+.swift
Normal file
16
Xcodes/Frontend/Common/String+.swift
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// String+.swift
|
||||
// Xcodes
|
||||
//
|
||||
// Created by Jinyu Meng on 2024/01/20.
|
||||
// Copyright © 2024 Robots and Pencils. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension String {
|
||||
// Declare String as String explicitly. Prevent it from being recognized as a LocalizedStringKey.
|
||||
var hideInLocalizations: String {
|
||||
return String(self)
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ extension View {
|
|||
struct Previews_CornerRadius_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
HStack {
|
||||
Text("XCODES RULES!")
|
||||
Text("XCODES RULES!".hideInLocalizations)
|
||||
}.xcodesBackground()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ struct IdenticalBuildsView: View {
|
|||
.font(.headline)
|
||||
|
||||
ForEach(builds, id: \.description) { version in
|
||||
Text("• \(version.appleDescription)")
|
||||
Text("• \(version.appleDescription)".hideInLocalizations)
|
||||
.font(.subheadline)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ struct AdvancedPreferencePane: View {
|
|||
|
||||
GroupBox(label: Text("Active/Select")) {
|
||||
VStack(alignment: .leading) {
|
||||
Picker("OnSelect", selection: $appState.onSelectActionType) {
|
||||
Picker("OnSelect".hideInLocalizations, selection: $appState.onSelectActionType) {
|
||||
|
||||
Text(SelectedActionType.none.description)
|
||||
.tag(SelectedActionType.none)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ struct SignInCredentialsView: View {
|
|||
HStack {
|
||||
Text("AppleID")
|
||||
.frame(minWidth: 100, alignment: .trailing)
|
||||
TextField("example@icloud.com", text: $username)
|
||||
TextField("example@icloud.com".hideInLocalizations, text: $username)
|
||||
}
|
||||
HStack {
|
||||
Text("Password")
|
||||
|
|
|
|||
|
|
@ -97,33 +97,33 @@ struct AppStoreButtonStyle_Previews: PreviewProvider {
|
|||
Group {
|
||||
ForEach([ColorScheme.light, .dark], id: \.self) { colorScheme in
|
||||
Group {
|
||||
Button("OPEN", action: {})
|
||||
Button("OPEN".hideInLocalizations, action: {})
|
||||
.buttonStyle(AppStoreButtonStyle(primary: true, highlighted: false))
|
||||
.padding()
|
||||
.background(Color(.textBackgroundColor))
|
||||
.previewDisplayName("Primary")
|
||||
Button("OPEN", action: {})
|
||||
Button("OPEN".hideInLocalizations, action: {})
|
||||
.buttonStyle(AppStoreButtonStyle(primary: true, highlighted: true))
|
||||
.padding()
|
||||
.background(Color(.controlAccentColor))
|
||||
.previewDisplayName("Primary, Highlighted")
|
||||
Button("OPEN", action: {})
|
||||
Button("OPEN".hideInLocalizations, action: {})
|
||||
.buttonStyle(AppStoreButtonStyle(primary: true, highlighted: false))
|
||||
.padding()
|
||||
.disabled(true)
|
||||
.background(Color(.textBackgroundColor))
|
||||
.previewDisplayName("Primary, Disabled")
|
||||
Button("INSTALL", action: {})
|
||||
Button("INSTALL".hideInLocalizations, action: {})
|
||||
.buttonStyle(AppStoreButtonStyle(primary: false, highlighted: false))
|
||||
.padding()
|
||||
.background(Color(.textBackgroundColor))
|
||||
.previewDisplayName("Secondary")
|
||||
Button("INSTALL", action: {})
|
||||
Button("INSTALL".hideInLocalizations, action: {})
|
||||
.buttonStyle(AppStoreButtonStyle(primary: false, highlighted: true))
|
||||
.padding()
|
||||
.background(Color(.controlAccentColor))
|
||||
.previewDisplayName("Secondary, Highlighted")
|
||||
Button("INSTALL", action: {})
|
||||
Button("INSTALL".hideInLocalizations, action: {})
|
||||
.buttonStyle(AppStoreButtonStyle(primary: false, highlighted: false))
|
||||
.padding()
|
||||
.disabled(true)
|
||||
|
|
|
|||
Loading…
Reference in a new issue