LocalizationKit_iOS icon indicating copy to clipboard operation
LocalizationKit_iOS copied to clipboard

Lable values only load at second time

Open breakline87 opened this issue 6 years ago • 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

breakline87 avatar Jun 01 '18 14:06 breakline87

I will take a look

willpowell8 avatar Jun 01 '18 16:06 willpowell8

@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

willpowell8 avatar Jun 02 '18 09:06 willpowell8

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?

breakline87 avatar Jun 04 '18 22:06 breakline87

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

rursache avatar Jun 07 '18 06:06 rursache

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.

breakline87 avatar Aug 26 '18 22:08 breakline87