StanfordSpezi / SpeziTemplateApplication

Template application demonstrating the usage of the Stanford Spezi framework.
https://stanfordspezi.github.io/SpeziTemplateApplication
MIT License
97 stars 19 forks source link

Template Application always uses English localization #51

Closed vishnuravi closed 10 months ago

vishnuravi commented 10 months ago

Description

The template application always uses the English localization, even if modules have localization for other languages. This is likely because the template application only has an English localization and iOS does not allow mixed localization by default. Mixed localization can be set using CFBundleAllowMixedLocalizations.

See a related discussion here.

Reproduction

Set the language to "German" in either the Settings pane of the simulator, or in the Scheme Editor. This should result in modules which have German localization using German strings within the template application. However, the template application still uses English strings.

Expected behavior

We expect that if strings are available in a user's preferred language, they will be displayed. By default, iOS will not allow mixed localizations. The ideal solution is to add localizations for all languages to the template app that are supported by our modules. However, this is likely too much to expect developers to update when creating their own apps from the template. Alternatively, we can set CFBundleAllowMixedLocalizations to YES which will allow mixed localization by default. This would allow strings to be shown in the user's preferred language if available. As noted in the article linked above, there is a possible downside to this if individually localized strings are interpolated into each other, but this does not seem to an issue that will occur with our current application. The benefit of users being able to see at least part of the interface in their preferred language is likely to outweigh the downsides for most use cases.

Additional context

No response

Code of Conduct

PSchmiedmayer commented 10 months ago

Thank you for the insights here! I think it would make sense to add this as a default behaviour to the application. Ideally, we should only enable localization for the languages that we support across all Spezi modules (currently only English, some German, and now some new Spanish ones 🎉) but that might not be realistic.

It might make sense to make this the default behavior and maybe add a call for action in the README to support localization across the packages if anyone wants to localize the template app and the different modules?

Maybe this is something we can add in #50 as we already update the README and can add the flag there?

vishnuravi commented 10 months ago

Sounds good @PSchmiedmayer. #50 was closed and the changes/feedback there will be rolled into a larger documentation revamp PR. Should we also roll this update into that?

PSchmiedmayer commented 10 months ago

Wanted to work on a few smaller fixes anyways that are not worth smaller PRs so I just merged everything in a single PR and also added this issue here: https://github.com/StanfordSpezi/SpeziTemplateApplication/pull/52.