Hi,
with tabBarItem.title i'm able to localize title when it is in viewDidLoad or viewWillappear but the localization will only happen when the tab becomes actives, otherwise it will show default value.
How could I localize, programmatically, the item title without the need to make it active?
Code Block tabBarItem.title = "LevelsVC-TabBarItem".localize()
with tabBarItem.title i'm able to localize title when it is in viewDidLoad or viewWillappear but the localization will only happen when the tab becomes actives, otherwise it will show default value.
How could I localize, programmatically, the item title without the need to make it active?
UITabBarController collects tabBarItems of the content view controllers just after they are initialized.Here is an example. LevelsViewController is a view controller that is displayed when tapping a tab bar item.
It is too late in viewDidLoad or viewWillAppear.
Try something like this:
Code Block override func awakeFromNib() { super.awakeFromNib() tabBarItem.title = "LevelsVC-TabBarItem".localize() }
Or
Code Block required init?(coder: NSCoder) { super.init(coder: coder) tabBarItem.title = "LevelsVC-TabBarItem"//.localize() }
In this scenario, you have no need to subclass UITabBarController.