Skip to content

Commit

Permalink
Add bundle to tutorial translator
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Aug 28, 2023
1 parent 376950a commit 0d5f2c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Release Notes


## 6.1.1
## 6.1.1, 6.1.2

### ✨ New features

Expand Down
5 changes: 3 additions & 2 deletions Sources/OnboardingKit/Tutorials/LocalizedTutorial.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ open class LocalizedTutorial: Tutorial<TutorialPage> {
resourceName: ResourceNameResolver = LocalizedTutorial.resourceName,
resourceKeySeparator: ResourceKeySeparator = ".",
pageResolver: @escaping PageResolver,
translator: @escaping Translator = { NSLocalizedString($0, comment: "") }
translator: Translator?
) {
var index = 0
var pages = [TutorialPage]()
var titleKey = resourceName(id, index, pageIndicationKey, resourceKeySeparator)
let translator = translator ?? { NSLocalizedString($0, bundle: bundle, comment: "") }
while titleKey != translator(titleKey) {
let page = pageResolver(id, index, bundle, resourceName, resourceKeySeparator)
pages.append(page)
Expand Down Expand Up @@ -92,7 +93,7 @@ public extension LocalizedTutorial {
pageIndicationKey: String = "title",
resourceName: ResourceNameResolver = LocalizedTutorial.resourceName,
resourceKeySeparator: ResourceKeySeparator = ".",
translator: @escaping Translator = { NSLocalizedString($0, comment: "") }
translator: Translator? = nil
) {
self.init(
id: id,
Expand Down

0 comments on commit 0d5f2c4

Please sign in to comment.