Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
with:
lfs: true
- name: Test BSWInterfaceKit iOS
run: set -o pipefail && xcodebuild -scheme BSWInterfaceKit -destination "platform=iOS Simulator,name=iPhone 17,OS=26.4.1" test | xcbeautify --renderer github-actions
run: set -o pipefail && xcodebuild -scheme BSWInterfaceKit -destination "platform=iOS Simulator,name=iPhone 17,OS=latest" test | xcbeautify --renderer github-actions

macos-build:
runs-on: mobile
Expand Down
16 changes: 15 additions & 1 deletion Sources/BSWInterfaceKit/Extensions/Localizable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ import Foundation

extension String {
var localized: String {
return NSLocalizedString(self, bundle: Bundle.main, comment: "")
LocalizationService.localized(self)
}
}

public enum LocalizationService {
/// Default localization hook used by InterfaceKit strings.
///
/// On Apple platforms, looking up strings from `Bundle.main` works because the
/// host app owns the main bundle and ships its localized resources there.
/// Other runtimes do not necessarily have an equivalent app bundle lookup.
/// 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 😄

NSLocalizedString($0, bundle: .main, comment: "")
}
}
Loading