Hi,
here is a curious behavior hapening to my app.
Here is the use case.
App base lang is english.
Other translation is french
On a view controller, I have this: self.introTextView.text = "DogProfileEditionVC-IntroTextView".localize()
On corresponding language files I have these:
"DogProfileEditionVC-IntroTextView" = "french text";
"DogProfileEditionVC-IntroTextView" = "english text";
Use case on a freshly opened or built app: Load viewcontroller. Text is correctly displayed in language.
dismiss view controller.
Open view controller again: text loaded is neither from the translation file, but from the storyboard.
So on first loading after app was closed, opened, or built, the view controller shows correct text. On subsequent display, it ignores translation files and only load text from storyboard.
This happens only one one view controller, and 3 texts. This doesn't happen on some text on the same VC.
Why this strange behavior? Why does it localize only on first presentation of the view controller, and not on subsequent opening unless I close app in between?
(i tried to reinstall app, clean build folder)
Here are the string extensions used to localize:
// Add method to Strings for easily triggering the localization process.
extension String {
func localize() - String {
return NSLocalizedString(
self,
tableName: "Localizable",
bundle: .main,
value: self,
comment: self)
}
public func localize(with arguments: [CVarArg]) - String {
return String(format: self.localize(), locale: nil, arguments: arguments)
}
}