Firebase remote config instant localization after language change on app
If you want to force a request to the server for a single request, you can use this API which lets you override the minimumFetchInterval (example in Swift):
remoteConfig.fetch(withExpirationDuration: TimeInterval(0)) { (status, error) -> Void in
...
}
Be sure to only use this in a part of your app that happens infrequently, otherwise you may get temporarily throttled.
Antonis Radz
Passionate Android Developer. Skilled in Java, RxJava, Kotlin, MVP, GIT, Agile, Clean Architecture, Jenkins, Android development and testing. Also good knowledge and understanding in many other programming languages and architectures. Strong engineering knowledge gained with a Bachelor's degree of IT engineering focused in Information Technology from XAMK- South-Eastern Finland University of Applied Sciences and Bachelor's degree of Network administration in Kaunas university of applied science, Lithuania.
Updated on December 19, 2022Comments
-
Antonis Radz over 1 year
is there a way to instantly reload
FirebaseRemoteConfig
cache after app locale changed on app?It is working as expected while using development mode because
minimumFetchIntervalInSeconds
is set0
so basically it does not store cache at all.But when comes to production version it does need to wait while
FirebaseRemoteConfig
cache fetch interval ends.For localization I am using: USER_PROPERTY -> LANGUAGE_CODE which is set after user changes language on app.
-
Antonis Radz about 4 yearsI am using similar strategy, except doing
remoteConfig.reset()
and then doing re fetch. But I don't think that is the best practice, what if user changes language on app 10 times an hour? Of course it is not common case, but....