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

[iOS] request improvement of systemLocale #200

Closed
andrea689 opened this issue Apr 1, 2021 · 5 comments
Closed

[iOS] request improvement of systemLocale #200

andrea689 opened this issue Apr 1, 2021 · 5 comments

Comments

@andrea689
Copy link

Hi all!
If in Info.plist we have Localizations with en and it, and the device have cs system language, I expect the app to be in English but the text recognition in Czech.

On Android it works fine and Czech is recognized, but on iOS English is used.

speech.systemLocale() return cs in Android and en in iOS

If I add cs on Info.plist, speech.systemLocale() return cs also in iOS

But changing Info.plist is not correct because this language is not supported by app.

Without modify Info.plist, if I use Platform.localeName in iOS I get correct system locale: cs, why don't you use this to choose the default language?

@sowens-csd
Copy link
Contributor

Great question, the short answer is, I'm not sure. In iOS I use Locale.current https://developer.apple.com/documentation/foundation/locale/2293654-current to get the current Locale of the device. I had thought that would be returning the user's preferred language on their local device. From what you're describing it sounds like that locale is constrained in some way by the languages supported by the app. That would be odd and the documentation of the property doesn't mention it. Still, it wouldn't be the first odd thing on iOS.

To reproduce this it sounds like all I have to is have a device set to a language that is not supported by the app, is that correct?

@andrea689
Copy link
Author

Yes it's correct! in this case the default language supported by the app will be used and not that of the device

@sowens-csd
Copy link
Contributor

That's very interesting, thanks. I did not think that the locale property worked that way. I'll do some research and see if I can work around that. Since Platform.localeName works correctly it should be possible to use the same source.

@sowens-csd
Copy link
Contributor

I just committed a change that should address this. The language returned by systemLocale is now independent of the app localization. If anyone has a chance to try the repo version let me know how it goes.

I'm also looking for input on expected behaviour. I kind of understand Apple's thinking on this. If the app isn't localized for a language, like CS, then using that for speech might be problematic. I think it is still okay to return the real device language as the systemLocale because it is then doing what it says on the tin. But I am wondering if there should be another property, something like appLocale that keeps the current behaviour.

@sowens-csd
Copy link
Contributor

This is now available in 4.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants