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
No longer works since the swizzling removal. #46
Comments
|
Hi, if you can also explain what stopped working exactly. like the strings now are not getting localized? or something else? |
|
Thank you for the quick response. Yes, the strings stopped being localized. I've added the code you provided: And then changed the Swiftgen template we're using to call the @Abedalkareem Also, can you please explain how LanguageManager can function properly without swizzling when it comes to Storyboards and Nibs? Thanks again. |
|
Hi Eldare, @objc func swizzledAwakeFromNib() {
swizzledAwakeFromNib()
switch self {
case let txtf as UITextField:
txtf.text = txtf.text?.localiz()
txtf.placeholder = txtf.placeholder?.localiz()
case let lbl as UILabel:
lbl.text = lbl.text?.localiz()
case let tabbar as UITabBar:
tabbar.items?.forEach({ $0.title = $0.title?.localiz() })
case let btn as UIButton:
btn.setTitle(btn.title(for: .normal)?.localiz(), for: .normal)
case let sgmnt as UISegmentedControl:
(0 ..< sgmnt.numberOfSegments).forEach { sgmnt.setTitle(sgmnt.titleForSegment(at: $0)?.localiz(), forSegmentAt: $0) }
case let txtv as UITextView:
txtv.text = txtv.text?.localiz()
default:
break
}
}to localize the text. Thank you again and sorry for the delay I just so your comment. |
|
Hi @Abedalkareem, I think there may be a better solution than swizzling. You could just override awakeFromNib() like this: |
I've upgraded from
v1.1.3tov1.2.1, and it stopped working.LanguageManager.shared.setLanguage(language:)no longer has the same affect.I went over the commits and noticed
v1.1.4had a change to the swizzling part:f98e6ee add new comments, remove the swizzling for the bundleI then tested with
v1.1.4, and it doesn't work either.Do I need to do something new to make it work again, since the swizzle removal?
I don't use StoryBoards and Nibs, everything is done programmatically.
After calling
setLanguage(language:)therootViewControlleris reloaded as part of my app's architecture.Thank you.
The text was updated successfully, but these errors were encountered: