firebase / firebase/firebase-android-sdk
language locale is not set after calling `setLanguageCode` & appears as "und" in Auth blocking function.
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 34
Description
### [READ] Step 1: Are you in the right place?
Yes, right place.
### [REQUIRED] Step 2: Describe your environment
* Android Studio version: 2022.3.1
* Firebase Component: Auth (Database, Firestore, Storage, Functions, etc)
* Component version: 22.3.1
### [REQUIRED] Step 3: Describe the problem
language locale in auth blocking function is "und" which means undetermined. This is occuring even when setting the language code.
First reported on FlutterFire repo: https://github.com/firebase/flutterfire/issues/12519
This is not an issue on firebas-ios-sdk.
Logcat shows why it is "und":
```
2024-04-03 09:50:57.889 26056-26147 System io.flutter.plugins.firebase.tests W Ignoring header X-Firebase-Locale because its value was null.
```
#### Steps to reproduce:
I have a repo with reproduction here: https://github.com/russellwheatley/firebase-android
Here are the steps taken from README:
1. Update applicationId & namespace in app/build.gradle to your app in your firebase project.
2. Update app/google-services.json to your firebase project.
3. Run `npm i` in backend/functions directory followed by `npm run deploy` to deploy the cloud functions to your firebase project.
4. Run the app on an emulator and press the button in the bottom right hand corner to set the language, create a user and trigger the cloud function.
5. Head to the cloud function logs and observe the locale as `authBeforeUserCreated {"locale":"und",....other properties}.` This should be "en-US".
#### Relevant Code:
```java
FirebaseApp app = FirebaseApp.getInstance();
FirebaseAuth auth = FirebaseAuth.getInstance(app);
auth.setLanguageCode("en-US");
auth.createUserWithEmailAndPassword("test-email@testemail.com", "qwerty123").addOnCompleteListener(task -> {
if (task.isSuccessful()) {
Log.d(TAG, "User created successfully");
} else {
Log.d(TAG, "User creation failed");
}
});
```
Contributor guide
Assessment
This issue has not been assessed yet.