Prevent Text("string") from being exported as localization
Asked Answered
N

2

6

I have a few Text("dummy") within SwiftUI previews. Every time I perform export localizations, these would get exported. Is there any way to manually mark them as "do not localize"?

Nappe answered 26/12, 2021 at 14:26 Comment(1)
Does this answer your question? Difference between Text("") and Text(verbatim: "") initializers in SwiftUIRicebird
W
14

Use with verbatim constructor, like

Text(verbatim: "dummy")
Weak answered 26/12, 2021 at 14:44 Comment(0)
O
-1

Convenient way to use keep always safe and get rid of Text() localisation globally. It will override the default init and get rid of localisation.

extension Text {
    public init<S>(_ content: S) where S : StringProtocol {
        self.init(verbatim: String(content))
    }
}
Osmic answered 6/8, 2023 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.