14
14
* limitations under the License.
15
15
*/
16
16
17
- import { english , Locale , RegisteredTranslations , TranslationsConfig } from "@firebase-ui/translations" ;
17
+ import { enUs , RegisteredLocale } from "@firebase-ui/translations" ;
18
18
import type { FirebaseApp } from "firebase/app" ;
19
19
import { Auth , getAuth } from "firebase/auth" ;
20
20
import { deepMap , DeepMapStore , map } from "nanostores" ;
@@ -23,20 +23,18 @@ import { FirebaseUIState } from "./state";
23
23
24
24
type FirebaseUIConfigurationOptions = {
25
25
app : FirebaseApp ;
26
- locale ?: Locale | undefined ;
27
- translations ?: RegisteredTranslations [ ] | undefined ;
28
- behaviors ?: Partial < Behavior < keyof BehaviorHandlers > > [ ] | undefined ;
29
- recaptchaMode ?: "normal" | "invisible" | undefined ;
26
+ locale ?: RegisteredLocale ;
27
+ behaviors ?: Partial < Behavior < keyof BehaviorHandlers > > [ ] ;
28
+ recaptchaMode ?: "normal" | "invisible" ;
30
29
} ;
31
30
32
31
export type FirebaseUIConfiguration = {
33
32
app : FirebaseApp ;
34
33
getAuth : ( ) => Auth ;
35
- setLocale : ( locale : Locale ) => void ;
34
+ setLocale : ( locale : RegisteredLocale ) => void ;
36
35
state : FirebaseUIState ;
37
36
setState : ( state : FirebaseUIState ) => void ;
38
- locale : Locale ;
39
- translations : TranslationsConfig ;
37
+ locale : RegisteredLocale ;
40
38
behaviors : Partial < Record < BehaviorKey , BehaviorHandlers [ BehaviorKey ] > > ;
41
39
recaptchaMode : "normal" | "invisible" ;
42
40
} ;
@@ -57,25 +55,13 @@ export function initializeUI(config: FirebaseUIConfigurationOptions, name: strin
57
55
{ } as Record < BehaviorKey , BehaviorHandlers [ BehaviorKey ] >
58
56
) ;
59
57
60
- config . translations ??= [ ] ;
61
-
62
- // TODO: Is this right?
63
- config . translations . push ( english ) ;
64
-
65
- const translations = config . translations ?. reduce ( ( acc , translation ) => {
66
- return {
67
- ...acc ,
68
- [ translation . locale ] : translation . translations ,
69
- } ;
70
- } , { } as TranslationsConfig ) ;
71
-
72
58
$config . setKey (
73
59
name ,
74
60
deepMap < FirebaseUIConfiguration > ( {
75
61
app : config . app ,
76
62
getAuth : ( ) => getAuth ( config . app ) ,
77
- locale : config . locale ?? english . locale ,
78
- setLocale : ( locale : Locale ) => {
63
+ locale : config . locale ?? enUs ,
64
+ setLocale : ( locale : RegisteredLocale ) => {
79
65
const current = $config . get ( ) [ name ] ! ;
80
66
current . setKey ( `locale` , locale ) ;
81
67
} ,
@@ -84,7 +70,6 @@ export function initializeUI(config: FirebaseUIConfigurationOptions, name: strin
84
70
const current = $config . get ( ) [ name ] ! ;
85
71
current . setKey ( `state` , state ) ;
86
72
} ,
87
- translations,
88
73
behaviors : behaviors ?? { } ,
89
74
recaptchaMode : config . recaptchaMode ?? "normal" ,
90
75
} )
0 commit comments