-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fallback translation bundle method #5314
Add fallback translation bundle method #5314
Conversation
46ea619
to
8267577
Compare
Codecov ReportBase: 46.57% // Head: 46.56% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #5314 +/- ##
==========================================
- Coverage 46.57% 46.56% -0.02%
==========================================
Files 180 180
Lines 14449 14450 +1
==========================================
- Hits 6729 6728 -1
- Misses 7720 7722 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@@ -30,7 +30,7 @@ public class NimbusBuilder { | |||
* A closure for reporting errors from Rust. | |||
*/ | |||
@discardableResult | |||
func withErrorReporter(_ reporter: @escaping NimbusErrorReporter) -> NimbusBuilder { | |||
func with(errorReporter reporter: @escaping NimbusErrorReporter) -> NimbusBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with this code format, could you briefly explain what's happening here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Swift has named arguments as part of the name of the method, and the Swift trend has been to embrace that, so now we write:
builder.with(errorReporter: theReporter)
instead of:
builder.withErrorReporter(theReporter)
The syntax above is:
func methodName(namedArg localName: Type)
where namedArg
is _
, then it's omitted when calling (like withErrorReporter(theReporter)
).
and localName
is optional, and that's the name of the argument in the method.
func methodName(namedArg localName: Type) {
}
is syntactic sugar for:
func methodName(namedArg: Type) {
let localName = namedArg
}
Let me know if this does/doesn't help.
Related to EXP-3042.
The functional part of this is the adding a fallback translation bundle lookup method.
It's actually quite difficult to test, given that there are no strings in the ios megazord, so there exists a duplicate method in Firefox for iOS. We include it here since we want to use it in Focus.
Because Nimbus doesn't know the internal structure of the bundle it can only provide this
fallbackTranslationBundle()
method— it will be up to the app to provide the list of bundles themselves.The old way of doing this was to call
Nimbus.create(… resourceBundles: [Bundle.main, Strings.bundle] )
. The new way of doing this will be:Pull Request checklist
[ci full]
to the PR title.Branch builds: add
[ff-android: firefox-android-branch-name]
and/or[fenix: fenix-branch-name]
to the PR title.