firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

FR: Setting languageCode for Messaging

Open srini2dl opened this issue 5 years ago • 8 comments

Feature proposal

  • Firebase Component: InAppMessage

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"

srini2dl avatar Apr 23 '20 23:04 srini2dl

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

christibbs avatar Apr 24 '20 17:04 christibbs

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

christibbs avatar May 05 '20 16:05 christibbs

@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?

charlotteliang avatar May 05 '20 16:05 charlotteliang

@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

srini2dl avatar May 05 '20 17:05 srini2dl

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?

charlotteliang avatar May 06 '20 20:05 charlotteliang

@chliangGoogle yes that's correct.

srini2dl avatar May 06 '20 20:05 srini2dl

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

charlotteliang avatar May 06 '20 21:05 charlotteliang

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.

dweekly avatar Mar 22 '22 22:03 dweekly