swift-markdown-ui icon indicating copy to clipboard operation
swift-markdown-ui copied to clipboard

Localization Support?

Open thatvirtualboy opened this issue 4 years ago • 3 comments
trafficstars

Hi there, thank you for making this. I've noticed it doesn't appear to work with Localization. The strings aren't read in the Localizable.strings files since they're not Text() but rather Markdown ()

Any ways around this?

thatvirtualboy avatar Apr 02 '21 22:04 thatvirtualboy

Sorry for the late response. MarkdownUI does not support LocalizedStringKey at the moment, but I might consider adding support in the future. As a workaround, you can use the good old NSLocalizedString:

Markdown(NSLocalizedString("yourLocalizedStringKey", comment: ""))

gonzalezreal avatar Apr 15 '21 09:04 gonzalezreal

I also need this function.

At present, I read the String file according to the language, and then directly pass the parameters to the Markdown method. If there is a better idea, it should be realized as soon as possible. thank you

PS:

I like this open source project very much and hope to stick to it. Thank you for your contribution to open source. Thank you very much

SF-Simon avatar Apr 17 '21 01:04 SF-Simon

Unfortunately, I can't add support for LocalizedStringKey because its properties are not accessible. Maybe Apple opens this API in a future SwiftUI release. For the moment, we have to stick to the workaround that I mentioned previously.

gonzalezreal avatar Apr 25 '21 08:04 gonzalezreal