Skip to content
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

Phrase OTA no working on First Relaunch #78

Open
DineshThakur opened this issue Sep 9, 2024 · 5 comments
Open

Phrase OTA no working on First Relaunch #78

DineshThakur opened this issue Sep 9, 2024 · 5 comments
Assignees

Comments

@DineshThakur
Copy link

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.

@hahmed-dev hahmed-dev self-assigned this Sep 10, 2024
@theSoenke
Copy link
Contributor

theSoenke commented Sep 11, 2024

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
Copy link
Author

@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
Copy link
Contributor

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.

@DineshThakur
Copy link
Author

@theSoenke

We have handled the fallback.
If Phrase.shared.localizedString is not giving the value for given key, we are fetching it from local bundle.

As it cache the translation of one language. When we switch from one language to another, how long it take to download the data.

As of now when we switch from one language to another, we need need to kill and relaunch the app multiple time, then only newly text appear in newly selected language.
Is this expected?

In Android it works perfectly, when we switch from one language to another.

@carstenapploft
Copy link
Collaborator

Hi @DineshThakur ,

the SDK needs a maximum of 2 app starts to display the OTA translations.

If we take this process:

  • new OTA Release
  • 1st App Start (SDK will download the new OTA Release but will return Translation from the main bundle or the previous OTA Update)
  • 2nd App Start (SDK will use the new OTA Release)

We need 2 app launches because Apple caches bundles. We have the translations shortly after the first app start and these are also saved in the file system, but the previous data is still in the bundle cache.

If you need more than 2 app launches, then there is a problem. Please check what the result of updateTranslation is. If updateTranslation returns a .success(true) new translations have been successfully pulled and should be there after the next app start.

We still had problems in old SDK versions, so I also recommend to use the latest version if not already done.

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

4 participants