onesky / plugin-ios-ota

Over the air plugin
50 stars 8 forks source link

Language Order Issue on First Launch with No Internet Connection #28

Closed keithbhunter closed 6 years ago

keithbhunter commented 6 years ago

I have a project setup with several supported languages (en, fr, de, it). The development language is en. The user has the ability to change the language in the app, which then calls OneSkyOTAPlugin.setLanguage(_:) with the new language. This works great if you have called OneSkyOTAPlugin.checkForUpdate() and successfully downloaded all the translations. However, the issue comes when you don't have internet connection.

All of the translations files are added into the Xcode project at each build, so that in the case the user installs the app and launches it without an internet connection, or OneSky is down when the user installs the app, the user still has a somewhat up-to-date set of translations available to them. As long as the user doesn't change the language in the app, everything is fine. If the user changes the language, the fallback logic breaks it seems.

Here's the scenario:

So it seems, at least from an outside perspective, that setLanguage(_:) is only good for looking up translations in the downloaded copy of the translations. If you haven't downloaded the translations, then it falls back to the main bundle using the device's language instead of setLanguage(_:).

In the scenario above, I would expect the framework to look up strings in this order: 1) Look for "it-IT" in the downloaded translations. If that fails, 2) Look for "it" in the downloaded translations. If that fails, 3) Look for the development in the downloaded translations. If that fails, 4) Look for "it-IT" in the main bundle. If that fails, 5) Look for "it" in the main bundle. If that fails, 6) Look for the development language in the main bundle. If that fails,

rubyluk commented 6 years ago

Thank you for the detailed description and all these helpful scenarios, the issue is fixed in https://github.com/onesky/plugin-ios-ota/releases/tag/0.10.1