Missing LocalizedStringResource

LocalizedStringResource is included on Darwin platforms, but seems to be missing from swift-foundation (and swift-corelibs-foundation). This would be a useful API for us. Is there any principled reason for its absence?

1 Like

Good question! You're correct that LocalizedStringResource is currently Darwin-only and doesn't yet exist on Linux/Windows. LocalizedStringResource could definitely be a valuable, cross-platform API for representing localized strings even on non-Darwin platforms and I could see it being added to one of the open source repos in the future. The main reason it doesn't exist there today is mainly that there's still a few dependencies that would need to exist first (Bundle to represent the location of strings which currently exists in swift-corelibs-foundation but doesn't have a cross-platform, unified implementation in swift-foundation, components of loading localized attributed strings such as Markdown parsing, and string formatting to handle format specifiers in localized strings which is implemented in CoreFoundation but is also missing a unified cross-platform implementation in swift-foundation). Without those dependencies, LocalizedStringResource itself doesn't have much utility, but it would be an important part of a cross-platform story for text localization with Foundation in the future if those features come to swift-foundation.

2 Likes