SvenTiigi / WhatsNewKit

Showcase your awesome new app features 📱
https://sventiigi.github.io/WhatsNewKit/
MIT License
3.87k stars 190 forks source link

String localization #73

Closed Meyssam120 closed 7 months ago

Meyssam120 commented 9 months ago

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.

SvenTiigi commented 8 months ago

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 commented 7 months ago

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