firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.69k stars 1.48k forks source link

FR: Setting languageCode for Messaging #5451

Open srini2dl opened 4 years ago

srini2dl commented 4 years ago

Feature proposal

In FIRMessaging.M the current locale takes the value from [NSLocale preferredLanguages] which doesn't return what the actual language is used in the app's UI

It would be great if there is a way, where we can set the languageCode like we have in FirebaseAuth Auth.auth().languageCode = "fr"

christibbs commented 4 years ago

Thanks for the feature request, @srini2dl. We will add this to the roadmap.

christibbs commented 4 years ago

Just realized that this for the Cloud Messaging SDK. Assigning to the current support on-call.

charlotteliang commented 4 years ago

@srini2dl we do use a list of language codes that is matching UI. https://github.com/firebase/firebase-ios-sdk/blob/793d7634906229f7ca58c571e3ebbc6caa5b79e0/FirebaseMessaging/Sources/FIRMessaging.m#L1027

is there a case that it doesn't fit your use case?

srini2dl commented 4 years ago

@chliangGoogle I was searching for a way to change the currentLocale that is set during function FIRMessagingSDKCurrentLocale https://github.com/firebase/firebase-ios-sdk/blob/793d7634906229f7ca58c571e3ebbc6caa5b79e0/FirebaseMessaging/Sources/FIRMessaging.m#L872

my case is I m using NSLocalizedString to localize my app but and in https://github.com/firebase/firebase-ios-sdk/blob/793d7634906229f7ca58c571e3ebbc6caa5b79e0/FirebaseMessaging/Sources/FIRMessaging.m#L1008

the function returns the locale based on the device NSLocale preferredLanguages-> this list does not indicate what language the app is actually running in and the currentLocale is set to the iPhone Language that is set on Setting Language & Region

charlotteliang commented 4 years ago

I see so you are saying your app is using a language that might not be the same as the system one on the device? So I guess it's a feature where like auth that allows developers to set an arbitrary language. Is my understanding of your case correct?

srini2dl commented 4 years ago

@chliangGoogle yes that's correct.

charlotteliang commented 4 years ago

Thanks for our feedback, we will add this to our roadmap.

dweekly commented 2 years ago

Hi - it's been about two years since an update - several of us developers are hoping this gets done as it will ease locale testing.