willpowell8/LocalizationKit_iOS

Lable values only load at second time

Opened this issue · 5 comments

Hello,

I have this problem where on first start I see the Labels instead of the values. I use this code in AppDelegate:

`func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
#if DEBUG
NetworkActivityLogger.shared.level = .debug
NetworkActivityLogger.shared.startLogging()
#endif
UITabBar.appearance().tintColor = UIColor.gray
Localization.start(appKey: "...")
Localization.ifEmptyShowKey = true
Localization.setLanguage("hun")
Localization.buildLanguageCode = "hun"

    return true
}`

This works, but only the second time. Also, loading into UILabels dont work at all, I had to populate them manually

I will take a look

@breakline87 you are looking for Hungarian as the language? If so the code should be hu rather than hun this would cause both issues you have mentioned. I will look at putting some validation into the codebase for the language codes

Well then the language wouldnt load the second time. I fixed this issue by using a timeout on my first screen to populate manually everything. Basically I suspect you can arrive at a screen and the language might be still loading while you call Localizationkit related functions?

same issue here. also, Localization.buildLanguageCode = "ro" does not work, it always defaults to english, not Romanian

Can we get an update on this? To summarize the problem, the localization module starts loading the language on start, but the user might reach the UI before loading the language file finishes. There is no "language available" listener or similar implemented, which would at least give us a way to know when can we direct the user to a screen where translations are used.