Skip to content

Lable values only load at second time #34

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

Open
breakline87 opened this issue Jun 1, 2018 · 5 comments
Open

Lable values only load at second time #34

breakline87 opened this issue Jun 1, 2018 · 5 comments

Comments

@breakline87
Copy link

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

@willpowell8
Copy link
Owner

I will take a look

@willpowell8
Copy link
Owner

willpowell8 commented Jun 2, 2018

@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

@breakline87
Copy link
Author

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?

@rursache
Copy link

rursache commented Jun 7, 2018

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

@breakline87
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants