phrase / ios-sdk

Phrase Over the Air iOS SDK
https://phrase.com
Other
14 stars 3 forks source link

Phrase OTA no working on First Relaunch #78

Open DineshThakur opened 1 week ago

DineshThakur commented 1 week ago

Hi Team,

Phrase OTA is not working on first time kill and relaunch the app. We need to kill and relaunch the app two time, then only phrase update is reflecting in the app.

Step to reproduce:- • Update string on phrase portal. • Release new version via OTA. • Kill and Relaunch the app. • Kill and relaunch the app 2nd time.

I have tried Phrase OTA with Phrase Demo app: - https://github.com/phrase/ios-demo-app

Same issue is there demo app as well. You have to kill and relaunch app two time then only updates are reflecting in app.

Even we have same issue when we switch from one language to another.

Suppose we are using our app in English. Go to Setting app and change the language from English to German. After changing the language, first you wont’ see text in German, if you kill and relaunch the app then text will appear in German Language, some how this is not good user experience.

Anytime line to fix this issue?

Pls let me know if you need any other details.

theSoenke commented 6 days ago

Hi @DineshThakur, this is currently the expected behaviour of the SDK. On first launch after a new release the translations will be fetched in the background to not delay the start of the app. On a second launch they're then displayed from the cache.

We're still looking into a way to immediately refresh the translations after a successful translations update. This is something that we hopefully can release later this year.

How is the language switching working in your app? Apple's recommendation is to use the iOS settings for language switching. This should also immediately display the correct translations from the included bundle

DineshThakur commented 6 days ago

@theSoenke

How is the language switching working in your app? Apple's recommendation is to use the iOS settings for language switching. This should also immediately display the correct translations from the included bundle

Comment:- In our app it works with iOS Settings only.

We are always using Phrase SDK (i.e Phrase.shared.localizedString) to get the value for given key. If we are not getting any value from Phrase SDK then fallback is to get the value for given key from Local Bundle.

Just want to understand how Phrase SDK support multiple language.

It download all the supported languages and cache them? Or it download a particular language at run time depend on device setting?

For example in our app, we are supporting around 30 languages, is Phrase SDK download and cached all these languages?

In our case when we are switching from one language to another, on verify first launch translation are not reflecting all the screen. You need to kill and relaunch the app couple of times then only translations is reflecting in all the screens.

theSoenke commented 1 day ago

Hi @DineshThakur, the SDK only fetches one locale that is currently displayed and then caches it. Is there a specific reason why you're calling Phrase.shared.localizedString directly? This method does not support falling back to bundled translations. If you're using translations from the main bundle it will use over-the-air translations and otherwise fallback to the bundled translations.