Skip to content

Add injectable localization hook for InterfaceKit strings#470

Merged
michele-theleftbit merged 3 commits into
developfrom
localization-service
May 13, 2026
Merged

Add injectable localization hook for InterfaceKit strings#470
michele-theleftbit merged 3 commits into
developfrom
localization-service

Conversation

@michele-theleftbit

Copy link
Copy Markdown
Contributor

Adds a small localization hook so BSWInterfaceKit strings can be resolved by the host app instead of always using Bundle.main.

On Apple platforms, Bundle.main works for app-owned localized resources. On other runtimes, especially Android/Skip, those strings need to be resolved through the host app localization system.

This keeps the existing Bundle.main behavior as the default while allowing apps to inject a custom resolver, for example to bridge InterfaceKit strings to Android resources or a runtime translation provider.

Example integration in a host app:

BSWInterfaceKit.ModuleDependencies.localizedString = {
    NaturitasCore.ModuleDependencies.localizationService.localized($0)
}

Comment thread .github/workflows/swift.yml Outdated
/// Android/Skip apps, in particular, should inject this closure from the host
/// app so strings are resolved through the app localization system, resources,
/// or any runtime translation provider.
public static nonisolated(unsafe) var localized: (String) -> String = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a great comment, I can tell the LLM loves you

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI is amazing when you give it the right words 😄

@michele-theleftbit michele-theleftbit merged commit 8c5ec37 into develop May 13, 2026
5 of 6 checks passed
@michele-theleftbit michele-theleftbit deleted the localization-service branch May 13, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants