phrase / ios-sdk

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

Use only configured app supported languages in OTA #34

Closed angelolloqui closed 1 year ago

angelolloqui commented 3 years ago

We have seen that there are unsupported languages shown in the app that were not expected.

The problem seems to be coming from OTA. When you have a new language created in Phrase, and you create an OTA, all devices are downloading all existing languages in Phrase and not only those listed in the supported languages of the app.

So, basically, if I run this:

Bundle.main.localizations

I get this list:

  - 0 : "en"
  - 1 : "es"
  - 2 : "it"
  - 3 : "sv"
  - 4 : "Base"
  - 5 : "fi"
  - 6 : "pt"
  - 7 : "ca"

But, since we have declared FR as a language in Phrase (not yet ready for production) and created an OTA, my french users are seeing a partially translated french version of the app.

Expected: To only do OTA of languages supported by the app.

winkelsdorf commented 3 years ago

Hello @angelolloqui,

thank you for reporting and reaching out.

We are only downloading one language at time, which is either Locale.preferredLanguages.first (or the given localeOverride). I think the problem is, that you already include french in your OTA release.

I am unsure if this is an SDK issue, maybe @theSoenke can shed some light on this speaking from the backend logic?

Best regards Frederik

theSoenke commented 3 years ago

Hey, right now the assumption is that translations included in a release on Phrase are ready for production. Restricting fetched locales to the supported locales from Bundle.main.localizations would prevent dynamically adding new languages with a release in Phrase. Another possible issue is regional local codes. For example en is part of Bundle.main.localizations but en-US is not.

Nonetheless, it is also a completely valid case that a locale might not be fully translated in Phrase yet. We've already been talking internally about making the release configuration a bit more powerful although this is still in an early phase and I'll keep you updated when there is any news.

angelolloqui commented 3 years ago

Thanks to both. Answering:

Restricting fetched locales to the supported locales from Bundle.main.localizations would prevent dynamically adding new languages with a release in Phrase

It is a valid point, but anyway adding dynamic languages will not fully work since the app settings will not show languages that are not included within the bundle, so you are giving a "partial" support

Talking internally about making the release configuration a bit more powerful

For us, if you provide a configuration in the client side with something like Phase.shared.restrictSupportedLanguages = true would be enough, and keep the default to false if you want to provide this out of the box

winkelsdorf commented 2 years ago

@angelolloqui Unfortunately, we have not yet implemented the suggestion with today's new release in order to avoid side effects.

However, I think that the new logic still fits well, because if localeOverride is not used or is only set to languages that are returned from Bundle.main.preferredLocalizations or elements returned from Bundle.main.localizations, localisation would also be limited to the languages of the main bundle.

Since I don't know of any other request along these lines, would the above behaviour be a solution for you?

Nevertheless, I will track this request as a feature request.

forelabs commented 1 year ago

Closing issue due to inactivity.