firebase / snippets-web

Web snippets for firebase.google.com
Apache License 2.0
736 stars 241 forks source link

(doc): fix an incorrect snippet #324

Closed thammarith closed 1 year ago

thammarith commented 1 year ago

For auth_set_language_code.js, the snippet for version 9 is incorrect. Presumably, it took the version 8's and hasn't been updated to correctly reflect version 9.

To use the device's language, useDeviceLanguage() has to be called directly from auth not firebase.auth() like version 8.

import { getAuth } from "firebase/auth";

const auth = getAuth();
auth.languageCode = 'it';
// To apply the default browser preference instead of explicitly setting it.
- // firebase.auth().useDeviceLanguage();
+ // auth.useDeviceLanguage();
google-cla[bot] commented 1 year ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

thatfiredev commented 1 year ago

@thammarith Thanks for finding this and putting up a PR! :)

As noted at the top, this file is auto-generated from auth-next/index.js. Can you please edit that file instead? And after editing, please run npm run snippets to regenerate the appropriate files. https://github.com/firebase/snippets-web/blob/1fd0e3fbfc0d1bb56120fe1a4b75f85e44225dee/snippets/auth-next/index/auth_set_language_code.js#L1-L5

thatfiredev commented 1 year ago

Hey @thammarith Just checking in on this

thatfiredev commented 1 year ago

This has been fixed in #352