WhatsNewKit icon indicating copy to clipboard operation
WhatsNewKit copied to clipboard

String localization

Open Meyssam120 opened this issue 1 year ago • 1 comments

Is your feature request related to a problem?

No

What solution would you like?

It would be great if Strings I enter as title, subtitle etc. would be localized automatically.

What alternatives have you considered?

This does not work: title: WhatsNew.Title(stringLiteral: .init(localized: "Lorem Ipsum")) And instead I have to use: title: "Lorem Ipsum?"

Any additional context?

Fyi: String(localized: ) does not change the string except you plan to translate it on purpose. So it will not lead to unintended behavior.

Meyssam120 avatar Dec 15 '23 18:12 Meyssam120

Hi @Meyssam120,

Thanks for opening up an issue. The preferred way of passing in a localized String is via String(localized:) as the WhatsNew.Title is using an NSAttributedString which doesn't accept a LocalizedStringResource or LocalizedStringKey.

WhatsNew.Title(
    text: WhatsNew.Text(
        String(
            localized: "My localized String"
        )
    )
)

SvenTiigi avatar Jan 18 '24 18:01 SvenTiigi

Closing due inactivity. Please feel free to re-open the issue at any time.

SvenTiigi avatar Feb 01 '24 19:02 SvenTiigi