@firebase-oss/ui-translations 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2016 Google Inc
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var a={errors:{userNotFound:"No account found with this email address",wrongPassword:"Incorrect password",invalidEmail:"Please enter a valid email address",userDisabled:"This account has been disabled",networkRequestFailed:"Unable to connect to the server. Please check your internet connection",tooManyRequests:"Too many failed attempts. Please try again later",emailAlreadyInUse:"An account already exists with this email",weakPassword:"Password should be at least 8 characters",operationNotAllowed:"Email/password accounts are not enabled. Please contact support.",invalidPhoneNumber:"The phone number is invalid",missingPhoneNumber:"Please provide a phone number",quotaExceeded:"SMS quota exceeded. Please try again later",codeExpired:"The verification code has expired",captchaCheckFailed:"reCAPTCHA verification failed. Please try again.",missingVerificationId:"Please complete the reCAPTCHA verification first.",missingEmail:"Please provide an email address",invalidActionCode:"The password reset link is invalid or has expired",credentialAlreadyInUse:"An account already exists with this email. Please sign in with that account.",requiresRecentLogin:"This operation requires a recent login. Please sign in again.",providerAlreadyLinked:"This phone number is already linked to another account",invalidVerificationCode:"Invalid verification code. Please try again",unknownError:"An unexpected error occurred",popupClosed:"The sign-in popup was closed. Please try again.",accountExistsWithDifferentCredential:"An account already exists with this email. Please sign in with the original provider.",displayNameRequired:"Please provide a display name",secondFactorAlreadyInUse:"This phone number is already enrolled with this account."},messages:{passwordResetEmailSent:"Password reset email sent successfully",signInLinkSent:"Sign-in link sent successfully",verificationCodeFirst:"Please request a verification code first",checkEmailForReset:"Check your email for password reset instructions",dividerOr:"or",termsAndPrivacy:"By continuing, you agree to our {tos} and {privacy}."},labels:{emailAddress:"Email Address",password:"Password",displayName:"Display Name",forgotPassword:"Forgot Password?",signUp:"Sign Up",signIn:"Sign In",resetPassword:"Reset Password",createAccount:"Create Account",backToSignIn:"Back to Sign In",signInWithPhone:"Sign in with Phone",phoneNumber:"Phone Number",verificationCode:"Verification Code",sendCode:"Send Code",verifyCode:"Verify Code",signInWithGoogle:"Sign in with Google",signInWithFacebook:"Sign in with Facebook",signInWithApple:"Sign in with Apple",signInWithMicrosoft:"Sign in with Microsoft",signInWithGitHub:"Sign in with GitHub",signInWithTwitter:"Sign in with Twitter",signInWithEmailLink:"Sign in with Email Link",sendSignInLink:"Send Sign-in Link",termsOfService:"Terms of Service",privacyPolicy:"Privacy Policy",resendCode:"Resend Code",sending:"Sending...",multiFactorEnrollment:"Multi-factor Enrollment",mfaTotpVerification:"TOTP Verification",mfaSmsVerification:"SMS Verification",generateQrCode:"Generate QR Code"},prompts:{noAccount:"Don't have an account?",haveAccount:"Already have an account?",enterEmailToReset:"Enter your email address to reset your password",signInToAccount:"Sign in to your account",enterDetailsToCreate:"Enter your details to create a new account",enterPhoneNumber:"Enter your phone number",enterVerificationCode:"Enter the verification code",enterEmailForLink:"Enter your email to receive a sign-in link",mfaEnrollmentPrompt:"Select a new multi-factor enrollment method"}};var h={"auth/user-not-found":"userNotFound","auth/wrong-password":"wrongPassword","auth/invalid-email":"invalidEmail","auth/user-disabled":"userDisabled","auth/network-request-failed":"networkRequestFailed","auth/too-many-requests":"tooManyRequests","auth/email-already-in-use":"emailAlreadyInUse","auth/weak-password":"weakPassword","auth/operation-not-allowed":"operationNotAllowed","auth/invalid-phone-number":"invalidPhoneNumber","auth/missing-phone-number":"missingPhoneNumber","auth/quota-exceeded":"quotaExceeded","auth/code-expired":"codeExpired","auth/captcha-check-failed":"captchaCheckFailed","auth/missing-verification-id":"missingVerificationId","auth/missing-email":"missingEmail","auth/invalid-action-code":"invalidActionCode","auth/credential-already-in-use":"credentialAlreadyInUse","auth/requires-recent-login":"requiresRecentLogin","auth/provider-already-linked":"providerAlreadyLinked","auth/invalid-verification-code":"invalidVerificationCode","auth/account-exists-with-different-credential":"accountExistsWithDifferentCredential","auth/display-name-required":"displayNameRequired","auth/second-factor-already-in-use":"secondFactorAlreadyInUse"};function o(e,i,n){let t=e.translations[i]?.[n];if(t)return t;if(e.fallback){let r=o(e.fallback,i,n);if(r)return r}return a[i][n]}function s(e,i,n){return {locale:e,translations:i,fallback:n}}var g=s("en-US",a);exports.ERROR_CODE_MAP=h;exports.enUs=g;exports.getTranslation=o;exports.registerLocale=s;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var o={errors:{userNotFound:"No account found with this email address",wrongPassword:"Incorrect password",invalidEmail:"Please enter a valid email address",userDisabled:"This account has been disabled",networkRequestFailed:"Unable to connect to the server. Please check your internet connection",tooManyRequests:"Too many failed attempts. Please try again later",missingVerificationCode:"Please enter the verification code",emailAlreadyInUse:"An account already exists with this email",invalidCredential:"The provided credentials are invalid.",weakPassword:"Password should be at least 8 characters",unverifiedEmail:"Please verify your email address to continue.",operationNotAllowed:"This operation is not allowed. Please contact support.",invalidPhoneNumber:"The phone number is invalid",missingPhoneNumber:"Please provide a phone number",quotaExceeded:"SMS quota exceeded. Please try again later",codeExpired:"The verification code has expired",captchaCheckFailed:"reCAPTCHA verification failed. Please try again.",missingVerificationId:"Please complete the reCAPTCHA verification first.",missingEmail:"Please provide an email address",invalidActionCode:"The password reset link is invalid or has expired",credentialAlreadyInUse:"An account already exists with this email. Please sign in with that account.",requiresRecentLogin:"This operation requires a recent login. Please sign in again.",providerAlreadyLinked:"This phone number is already linked to another account",invalidVerificationCode:"Invalid verification code. Please try again",unknownError:"An unexpected error occurred",popupClosed:"The sign-in popup was closed. Please try again.",accountExistsWithDifferentCredential:"An account already exists with this email. Please sign in with the original provider.",displayNameRequired:"Please provide a display name",secondFactorAlreadyInUse:"This phone number is already enrolled with this account."},messages:{passwordResetEmailSent:"Password reset email sent successfully",signInLinkSent:"Sign-in link sent successfully",verificationCodeFirst:"Please request a verification code first",checkEmailForReset:"Check your email for password reset instructions",dividerOr:"or",termsAndPrivacy:"By continuing, you agree to our {tos} and {privacy}.",mfaSmsAssertionPrompt:"A verification code will be sent to {phoneNumber} to complete the authentication process."},labels:{emailAddress:"Email Address",password:"Password",displayName:"Display Name",forgotPassword:"Forgot Password?",signUp:"Sign Up",signIn:"Sign In",resetPassword:"Reset Password",createAccount:"Create Account",backToSignIn:"Back to Sign In",signInWithPhone:"Sign in with Phone",phoneNumber:"Phone Number",verificationCode:"Verification Code",sendCode:"Send Code",verifyCode:"Verify Code",signInWithGoogle:"Sign in with Google",signInWithFacebook:"Sign in with Facebook",signInWithApple:"Sign in with Apple",signInWithMicrosoft:"Sign in with Microsoft",signInWithGitHub:"Sign in with GitHub",signInWithTwitter:"Sign in with X",signInWithEmailLink:"Sign in with Email Link",sendSignInLink:"Send Sign-in Link",termsOfService:"Terms of Service",privacyPolicy:"Privacy Policy",resendCode:"Resend Code",sending:"Sending...",multiFactorEnrollment:"Multi-factor Enrollment",multiFactorAssertion:"Multi-factor Authentication",mfaTotpVerification:"TOTP Verification",mfaSmsVerification:"SMS Verification",generateQrCode:"Generate QR Code"},prompts:{noAccount:"Don't have an account?",haveAccount:"Already have an account?",enterEmailToReset:"Enter your email address to reset your password",signInToAccount:"Sign in to your account",smsVerificationPrompt:"Enter the verification code sent to your phone number",enterDetailsToCreate:"Enter your details to create a new account",enterPhoneNumber:"Enter your phone number",enterVerificationCode:"Enter the verification code",enterEmailForLink:"Enter your email to receive a sign-in link",mfaEnrollmentPrompt:"Select a new multi-factor enrollment method",mfaAssertionPrompt:"Please complete the multi-factor authentication process",mfaAssertionFactorPrompt:"Please choose a multi-factor authentication method",mfaTotpQrCodePrompt:"Scan this QR code with your authenticator app",mfaTotpEnrollmentVerificationPrompt:"Add the code generated by your authenticator app"}};var p={"auth/user-not-found":"userNotFound","auth/wrong-password":"wrongPassword","auth/invalid-email":"invalidEmail","auth/unverified-email":"unverifiedEmail","auth/user-disabled":"userDisabled","auth/missing-code":"missingVerificationCode","auth/invalid-credential":"invalidCredential","auth/network-request-failed":"networkRequestFailed","auth/too-many-requests":"tooManyRequests","auth/email-already-in-use":"emailAlreadyInUse","auth/weak-password":"weakPassword","auth/operation-not-allowed":"operationNotAllowed","auth/invalid-phone-number":"invalidPhoneNumber","auth/missing-phone-number":"missingPhoneNumber","auth/quota-exceeded":"quotaExceeded","auth/code-expired":"codeExpired","auth/captcha-check-failed":"captchaCheckFailed","auth/missing-verification-id":"missingVerificationId","auth/missing-email":"missingEmail","auth/invalid-action-code":"invalidActionCode","auth/credential-already-in-use":"credentialAlreadyInUse","auth/requires-recent-login":"requiresRecentLogin","auth/provider-already-linked":"providerAlreadyLinked","auth/invalid-verification-code":"invalidVerificationCode","auth/account-exists-with-different-credential":"accountExistsWithDifferentCredential","auth/display-name-required":"displayNameRequired","auth/second-factor-already-in-use":"secondFactorAlreadyInUse"};function d(i,t,n,r){let s=i.translations[t]?.[n],e;if(s)e=s;else if(i.fallback){let a=d(i.fallback,t,n);a&&(e=a);}else e=o[t][n];return r&&(e=e?.replace(/{(\w+)}/g,(a,l)=>r[l]||a)),e||""}function c(i,t,n){return {locale:i,translations:t,fallback:n}}var y=c("en-US",o);exports.ERROR_CODE_MAP=p;exports.enUs=y;exports.getTranslation=d;exports.registerLocale=c;//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/locales/en-us.ts","../src/mapping.ts","../src/index.ts"],"names":["enUS","ERROR_CODE_MAP","getTranslation","locale","category","key","translatedString","fallbackTranslation","registerLocale","translations","fallback","enUs"],"mappings":"aAmBO,IAAMA,CAAAA,CAAO,CAClB,MAAA,CAAQ,CACN,YAAA,CAAc,0CAAA,CACd,aAAA,CAAe,oBAAA,CACf,YAAA,CAAc,oCAAA,CACd,YAAA,CAAc,gCAAA,CACd,qBAAsB,wEAAA,CACtB,eAAA,CAAiB,kDAAA,CACjB,iBAAA,CAAmB,2CAAA,CACnB,YAAA,CAAc,0CAAA,CACd,mBAAA,CAAqB,kEAAA,CACrB,kBAAA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ACF,OAAOA,CAAAA,CAIT,GAAIH,CAAAA,CAAO,QAAA,CAAU,CACnB,IAAMI,CAAAA,CAAsBL,CAAAA,CAAeC,CAAAA,CAAO,SAAUC,CAAAA,CAAUC,CAAG,CAAA,CAEzE,GAAIE,CAAAA,CACF,OAAOA,CAEX,CAIA,OAD+BP,CAAAA,CAAKI,CAAQ,CAAA,CACdC,CAAG,CACnC,CCjDO,SAASG,EACdL,CAAAA,CACAM,CAAAA,CACAC,CAAAA,CACkB,CAClB,OAAO,CACL,MAAA,CAAAP,CAAAA,CACA,aAAAM,CAAAA,CACA,QAAA,CAAAC,CACF,CACF,CAEO,IAAMC,CAAAA,CAAOH,CAAAA,CAAe,QAASR,CAAI","file":"index.cjs","sourcesContent":["/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type Translations } from \"../types\";\n\n// TODO: Should this be required or optional?\nexport const enUS = {\n errors: {\n userNotFound: \"No account found with this email address\",\n wrongPassword: \"Incorrect password\",\n invalidEmail: \"Please enter a valid email address\",\n userDisabled: \"This account has been disabled\",\n networkRequestFailed: \"Unable to connect to the server. Please check your internet connection\",\n tooManyRequests: \"Too many failed attempts. Please try again later\",\n emailAlreadyInUse: \"An account already exists with this email\",\n weakPassword: \"Password should be at least 8 characters\",\n operationNotAllowed: \"Email/password accounts are not enabled. Please contact support.\",\n invalidPhoneNumber: \"The phone number is invalid\",\n missingPhoneNumber: \"Please provide a phone number\",\n quotaExceeded: \"SMS quota exceeded. Please try again later\",\n codeExpired: \"The verification code has expired\",\n captchaCheckFailed: \"reCAPTCHA verification failed. Please try again.\",\n missingVerificationId: \"Please complete the reCAPTCHA verification first.\",\n missingEmail: \"Please provide an email address\",\n invalidActionCode: \"The password reset link is invalid or has expired\",\n credentialAlreadyInUse: \"An account already exists with this email. Please sign in with that account.\",\n requiresRecentLogin: \"This operation requires a recent login. Please sign in again.\",\n providerAlreadyLinked: \"This phone number is already linked to another account\",\n invalidVerificationCode: \"Invalid verification code. Please try again\",\n unknownError: \"An unexpected error occurred\",\n popupClosed: \"The sign-in popup was closed. Please try again.\",\n accountExistsWithDifferentCredential:\n \"An account already exists with this email. Please sign in with the original provider.\",\n displayNameRequired: \"Please provide a display name\",\n secondFactorAlreadyInUse: \"This phone number is already enrolled with this account.\",\n },\n messages: {\n passwordResetEmailSent: \"Password reset email sent successfully\",\n signInLinkSent: \"Sign-in link sent successfully\",\n verificationCodeFirst: \"Please request a verification code first\",\n checkEmailForReset: \"Check your email for password reset instructions\",\n dividerOr: \"or\",\n termsAndPrivacy: \"By continuing, you agree to our {tos} and {privacy}.\",\n },\n labels: {\n emailAddress: \"Email Address\",\n password: \"Password\",\n displayName: \"Display Name\",\n forgotPassword: \"Forgot Password?\",\n signUp: \"Sign Up\",\n signIn: \"Sign In\",\n resetPassword: \"Reset Password\",\n createAccount: \"Create Account\",\n backToSignIn: \"Back to Sign In\",\n signInWithPhone: \"Sign in with Phone\",\n phoneNumber: \"Phone Number\",\n verificationCode: \"Verification Code\",\n sendCode: \"Send Code\",\n verifyCode: \"Verify Code\",\n signInWithGoogle: \"Sign in with Google\",\n signInWithFacebook: \"Sign in with Facebook\",\n signInWithApple: \"Sign in with Apple\",\n signInWithMicrosoft: \"Sign in with Microsoft\",\n signInWithGitHub: \"Sign in with GitHub\",\n signInWithTwitter: \"Sign in with Twitter\",\n signInWithEmailLink: \"Sign in with Email Link\",\n sendSignInLink: \"Send Sign-in Link\",\n termsOfService: \"Terms of Service\",\n privacyPolicy: \"Privacy Policy\",\n resendCode: \"Resend Code\",\n sending: \"Sending...\",\n multiFactorEnrollment: \"Multi-factor Enrollment\",\n mfaTotpVerification: \"TOTP Verification\",\n mfaSmsVerification: \"SMS Verification\",\n generateQrCode: \"Generate QR Code\",\n },\n prompts: {\n noAccount: \"Don't have an account?\",\n haveAccount: \"Already have an account?\",\n enterEmailToReset: \"Enter your email address to reset your password\",\n signInToAccount: \"Sign in to your account\",\n enterDetailsToCreate: \"Enter your details to create a new account\",\n enterPhoneNumber: \"Enter your phone number\",\n enterVerificationCode: \"Enter the verification code\",\n enterEmailForLink: \"Enter your email to receive a sign-in link\",\n mfaEnrollmentPrompt: \"Select a new multi-factor enrollment method\",\n },\n} satisfies Translations;\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { enUS } from \"./locales/en-us\";\nimport { type RegisteredLocale } from \".\";\nimport type { ErrorKey, TranslationCategory, TranslationKey, TranslationSet } from \"./types\";\n\nexport const ERROR_CODE_MAP = {\n \"auth/user-not-found\": \"userNotFound\",\n \"auth/wrong-password\": \"wrongPassword\",\n \"auth/invalid-email\": \"invalidEmail\",\n \"auth/user-disabled\": \"userDisabled\",\n \"auth/network-request-failed\": \"networkRequestFailed\",\n \"auth/too-many-requests\": \"tooManyRequests\",\n \"auth/email-already-in-use\": \"emailAlreadyInUse\",\n \"auth/weak-password\": \"weakPassword\",\n \"auth/operation-not-allowed\": \"operationNotAllowed\",\n \"auth/invalid-phone-number\": \"invalidPhoneNumber\",\n \"auth/missing-phone-number\": \"missingPhoneNumber\",\n \"auth/quota-exceeded\": \"quotaExceeded\",\n \"auth/code-expired\": \"codeExpired\",\n \"auth/captcha-check-failed\": \"captchaCheckFailed\",\n \"auth/missing-verification-id\": \"missingVerificationId\",\n \"auth/missing-email\": \"missingEmail\",\n \"auth/invalid-action-code\": \"invalidActionCode\",\n \"auth/credential-already-in-use\": \"credentialAlreadyInUse\",\n \"auth/requires-recent-login\": \"requiresRecentLogin\",\n \"auth/provider-already-linked\": \"providerAlreadyLinked\",\n \"auth/invalid-verification-code\": \"invalidVerificationCode\",\n \"auth/account-exists-with-different-credential\": \"accountExistsWithDifferentCredential\",\n \"auth/display-name-required\": \"displayNameRequired\",\n \"auth/second-factor-already-in-use\": \"secondFactorAlreadyInUse\",\n} satisfies Record<string, ErrorKey>;\n\nexport type ErrorCode = keyof typeof ERROR_CODE_MAP;\n\nexport function getTranslation<T extends TranslationCategory>(\n locale: RegisteredLocale,\n category: T,\n key: TranslationKey<T>\n): string {\n const userTranslationSet = locale.translations[category] as TranslationSet<T> | undefined;\n const translatedString = userTranslationSet?.[key];\n\n if (translatedString) {\n return translatedString;\n }\n\n // Check fallback locale if it exists\n if (locale.fallback) {\n const fallbackTranslation = getTranslation(locale.fallback, category, key);\n\n if (fallbackTranslation) {\n return fallbackTranslation;\n }\n }\n\n // Fall back to English translations\n const fallbackTranslationSet = enUS[category] as TranslationSet<T>;\n return fallbackTranslationSet[key];\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { enUS } from \"./locales/en-us\";\nimport { type Translations } from \"./types\";\n\nexport type * from \"./types\";\nexport * from \"./mapping\";\n\nexport type Locale = \"en-US\" | `${string}-${string}` | string;\n\nexport function registerLocale(\n locale: Locale,\n translations: Translations,\n fallback?: RegisteredLocale\n): RegisteredLocale {\n return {\n locale,\n translations,\n fallback,\n };\n}\n\nexport const enUs = registerLocale(\"en-US\", enUS);\n\nexport type RegisteredLocale = {\n locale: Locale;\n translations: Translations;\n fallback?: RegisteredLocale;\n};\n"]}
1
+ {"version":3,"sources":["../src/locales/en-us.ts","../src/mapping.ts","../src/index.ts"],"names":["enUS","ERROR_CODE_MAP","getTranslation","locale","category","key","replacements","translatedString","str","fallbackTranslation","match","p1","registerLocale","translations","fallback","enUs"],"mappings":"aAmBO,IAAMA,CAAAA,CAAO,CAClB,MAAA,CAAQ,CACN,aAAc,0CAAA,CACd,aAAA,CAAe,oBAAA,CACf,YAAA,CAAc,qCACd,YAAA,CAAc,gCAAA,CACd,oBAAA,CAAsB,wEAAA,CACtB,gBAAiB,kDAAA,CACjB,uBAAA,CAAyB,oCAAA,CACzB,iBAAA,CAAmB,4CACnB,iBAAA,CAAmB,uCAAA,CACnB,YAAA,CAAc,0CAAA,CACd,gBAAiB,+CAAA,CACjB,mBAAA,CAAqB,wDAAA,CACrB,kBAAA,CAAoB,8BACpB,kBAAA,CAAoB,+BAAA,CACpB,aAAA,CAAe,4CAAA,CACf,YAAa,mCAAA,CACb,kBAAA,CAAoB,kDAAA,CACpB,qBAAA,CAAuB,oDACvB,YAAA,CAAc,iCAAA,CACd,iBAAA,CAAmB,mDAAA,CACnB,uBAAwB,8EAAA,CACxB,mBAAA,CAAqB,+DAAA,CACrB,qBAAA,CAAuB,yDACvB,uBAAA,CAAyB,6CAAA,CACzB,YAAA,CAAc,8BAAA,CACd,YAAa,iDAAA,CACb,oCAAA,CACE,uFAAA,CACF,mBAAA,CAAqB,gCACrB,wBAAA,CAA0B,0DAC5B,CAAA,CACA,QAAA,CAAU,CACR,sBAAA,CAAwB,wCAAA,CACxB,cAAA,CAAgB,gCAAA,CAChB,sBAAuB,0CAAA,CACvB,kBAAA,CAAoB,kDAAA,CACpB,SAAA,CAAW,KACX,eAAA,CAAiB,sDAAA,CACjB,qBAAA,CA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CAGlEF,CAAAA,EAAO,EAChB,CC9DO,SAASI,CAAAA,CACdT,CAAAA,CACAU,CAAAA,CACAC,EACkB,CAClB,OAAO,CACL,MAAA,CAAAX,EACA,YAAA,CAAAU,CAAAA,CACA,QAAA,CAAAC,CACF,CACF,CAGO,IAAMC,CAAAA,CAAOH,CAAAA,CAAe,QAASZ,CAAI","file":"index.cjs","sourcesContent":["/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type Translations } from \"../types\";\n\n/** English US (en-US) translation set with all default translations. */\nexport const enUS = {\n errors: {\n userNotFound: \"No account found with this email address\",\n wrongPassword: \"Incorrect password\",\n invalidEmail: \"Please enter a valid email address\",\n userDisabled: \"This account has been disabled\",\n networkRequestFailed: \"Unable to connect to the server. Please check your internet connection\",\n tooManyRequests: \"Too many failed attempts. Please try again later\",\n missingVerificationCode: \"Please enter the verification code\",\n emailAlreadyInUse: \"An account already exists with this email\",\n invalidCredential: \"The provided credentials are invalid.\",\n weakPassword: \"Password should be at least 8 characters\",\n unverifiedEmail: \"Please verify your email address to continue.\",\n operationNotAllowed: \"This operation is not allowed. Please contact support.\",\n invalidPhoneNumber: \"The phone number is invalid\",\n missingPhoneNumber: \"Please provide a phone number\",\n quotaExceeded: \"SMS quota exceeded. Please try again later\",\n codeExpired: \"The verification code has expired\",\n captchaCheckFailed: \"reCAPTCHA verification failed. Please try again.\",\n missingVerificationId: \"Please complete the reCAPTCHA verification first.\",\n missingEmail: \"Please provide an email address\",\n invalidActionCode: \"The password reset link is invalid or has expired\",\n credentialAlreadyInUse: \"An account already exists with this email. Please sign in with that account.\",\n requiresRecentLogin: \"This operation requires a recent login. Please sign in again.\",\n providerAlreadyLinked: \"This phone number is already linked to another account\",\n invalidVerificationCode: \"Invalid verification code. Please try again\",\n unknownError: \"An unexpected error occurred\",\n popupClosed: \"The sign-in popup was closed. Please try again.\",\n accountExistsWithDifferentCredential:\n \"An account already exists with this email. Please sign in with the original provider.\",\n displayNameRequired: \"Please provide a display name\",\n secondFactorAlreadyInUse: \"This phone number is already enrolled with this account.\",\n },\n messages: {\n passwordResetEmailSent: \"Password reset email sent successfully\",\n signInLinkSent: \"Sign-in link sent successfully\",\n verificationCodeFirst: \"Please request a verification code first\",\n checkEmailForReset: \"Check your email for password reset instructions\",\n dividerOr: \"or\",\n termsAndPrivacy: \"By continuing, you agree to our {tos} and {privacy}.\",\n mfaSmsAssertionPrompt: \"A verification code will be sent to {phoneNumber} to complete the authentication process.\",\n },\n labels: {\n emailAddress: \"Email Address\",\n password: \"Password\",\n displayName: \"Display Name\",\n forgotPassword: \"Forgot Password?\",\n signUp: \"Sign Up\",\n signIn: \"Sign In\",\n resetPassword: \"Reset Password\",\n createAccount: \"Create Account\",\n backToSignIn: \"Back to Sign In\",\n signInWithPhone: \"Sign in with Phone\",\n phoneNumber: \"Phone Number\",\n verificationCode: \"Verification Code\",\n sendCode: \"Send Code\",\n verifyCode: \"Verify Code\",\n signInWithGoogle: \"Sign in with Google\",\n signInWithFacebook: \"Sign in with Facebook\",\n signInWithApple: \"Sign in with Apple\",\n signInWithMicrosoft: \"Sign in with Microsoft\",\n signInWithGitHub: \"Sign in with GitHub\",\n signInWithTwitter: \"Sign in with X\",\n signInWithEmailLink: \"Sign in with Email Link\",\n sendSignInLink: \"Send Sign-in Link\",\n termsOfService: \"Terms of Service\",\n privacyPolicy: \"Privacy Policy\",\n resendCode: \"Resend Code\",\n sending: \"Sending...\",\n multiFactorEnrollment: \"Multi-factor Enrollment\",\n multiFactorAssertion: \"Multi-factor Authentication\",\n mfaTotpVerification: \"TOTP Verification\",\n mfaSmsVerification: \"SMS Verification\",\n generateQrCode: \"Generate QR Code\",\n },\n prompts: {\n noAccount: \"Don't have an account?\",\n haveAccount: \"Already have an account?\",\n enterEmailToReset: \"Enter your email address to reset your password\",\n signInToAccount: \"Sign in to your account\",\n smsVerificationPrompt: \"Enter the verification code sent to your phone number\",\n enterDetailsToCreate: \"Enter your details to create a new account\",\n enterPhoneNumber: \"Enter your phone number\",\n enterVerificationCode: \"Enter the verification code\",\n enterEmailForLink: \"Enter your email to receive a sign-in link\",\n mfaEnrollmentPrompt: \"Select a new multi-factor enrollment method\",\n mfaAssertionPrompt: \"Please complete the multi-factor authentication process\",\n mfaAssertionFactorPrompt: \"Please choose a multi-factor authentication method\",\n mfaTotpQrCodePrompt: \"Scan this QR code with your authenticator app\",\n mfaTotpEnrollmentVerificationPrompt: \"Add the code generated by your authenticator app\",\n },\n} satisfies Translations;\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { enUS } from \"./locales/en-us\";\nimport { type RegisteredLocale } from \".\";\nimport type { ErrorKey, TranslationCategory, TranslationKey, TranslationSet } from \"./types\";\n\n/** Maps Firebase authentication error codes to translation keys. */\nexport const ERROR_CODE_MAP = {\n \"auth/user-not-found\": \"userNotFound\",\n \"auth/wrong-password\": \"wrongPassword\",\n \"auth/invalid-email\": \"invalidEmail\",\n \"auth/unverified-email\": \"unverifiedEmail\",\n \"auth/user-disabled\": \"userDisabled\",\n \"auth/missing-code\": \"missingVerificationCode\",\n \"auth/invalid-credential\": \"invalidCredential\",\n \"auth/network-request-failed\": \"networkRequestFailed\",\n \"auth/too-many-requests\": \"tooManyRequests\",\n \"auth/email-already-in-use\": \"emailAlreadyInUse\",\n \"auth/weak-password\": \"weakPassword\",\n \"auth/operation-not-allowed\": \"operationNotAllowed\",\n \"auth/invalid-phone-number\": \"invalidPhoneNumber\",\n \"auth/missing-phone-number\": \"missingPhoneNumber\",\n \"auth/quota-exceeded\": \"quotaExceeded\",\n \"auth/code-expired\": \"codeExpired\",\n \"auth/captcha-check-failed\": \"captchaCheckFailed\",\n \"auth/missing-verification-id\": \"missingVerificationId\",\n \"auth/missing-email\": \"missingEmail\",\n \"auth/invalid-action-code\": \"invalidActionCode\",\n \"auth/credential-already-in-use\": \"credentialAlreadyInUse\",\n \"auth/requires-recent-login\": \"requiresRecentLogin\",\n \"auth/provider-already-linked\": \"providerAlreadyLinked\",\n \"auth/invalid-verification-code\": \"invalidVerificationCode\",\n \"auth/account-exists-with-different-credential\": \"accountExistsWithDifferentCredential\",\n \"auth/display-name-required\": \"displayNameRequired\",\n \"auth/second-factor-already-in-use\": \"secondFactorAlreadyInUse\",\n} satisfies Record<string, ErrorKey>;\n\n/** Firebase authentication error code type. */\nexport type ErrorCode = keyof typeof ERROR_CODE_MAP;\n\n/**\n * Retrieves a translation string for a given locale, category, and key.\n *\n * Falls back to the locale's fallback locale or English US if the translation is not found.\n * Supports string replacements using {placeholder} syntax.\n *\n * @param locale - The registered locale to get the translation from.\n * @param category - The translation category (e.g., \"errors\", \"labels\").\n * @param key - The translation key within the category.\n * @param replacements - Optional object with replacement values for placeholders in the translation string.\n * @returns The translated string, or an empty string if not found.\n */\nexport function getTranslation<T extends TranslationCategory>(\n locale: RegisteredLocale,\n category: T,\n key: TranslationKey<T>,\n replacements?: Record<string, string>\n): string {\n const userTranslationSet = locale.translations[category] as TranslationSet<T> | undefined;\n const translatedString = userTranslationSet?.[key];\n\n let str: string | undefined;\n\n if (translatedString) {\n str = translatedString;\n } else if (locale.fallback) {\n const fallbackTranslation = getTranslation(locale.fallback, category, key);\n\n if (fallbackTranslation) {\n str = fallbackTranslation;\n }\n } else {\n const fallbackTranslationSet = enUS[category] as TranslationSet<T>;\n str = fallbackTranslationSet[key];\n }\n\n if (replacements) {\n str = str?.replace(/{(\\w+)}/g, (match, p1) => replacements[p1] || match);\n }\n\n return str || \"\";\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { enUS } from \"./locales/en-us\";\nimport { type Translations } from \"./types\";\n\nexport type * from \"./types\";\nexport * from \"./mapping\";\n\n/** Locale identifier string. Supports BCP 47 format (e.g., \"en-US\") or any string. */\nexport type Locale = \"en-US\" | `${string}-${string}` | string;\n\n/**\n * Registers a locale with its translations and optional fallback locale.\n *\n * @param locale - The locale identifier (e.g., \"en-US\", \"fr-FR\").\n * @param translations - The translation object for this locale.\n * @param fallback - Optional fallback locale to use when a translation is missing.\n * @returns A registered locale object.\n */\nexport function registerLocale(\n locale: Locale,\n translations: Translations,\n fallback?: RegisteredLocale\n): RegisteredLocale {\n return {\n locale,\n translations,\n fallback,\n };\n}\n\n/** Pre-registered English US locale with default translations. */\nexport const enUs = registerLocale(\"en-US\", enUS);\n\n/** A registered locale with its translations and optional fallback. */\nexport type RegisteredLocale = {\n /** The locale identifier. */\n locale: Locale;\n /** The translation object for this locale. */\n translations: Translations;\n /** Optional fallback locale to use when a translation is missing. */\n fallback?: RegisteredLocale;\n};\n"]}
package/dist/index.d.cts CHANGED
@@ -13,93 +13,197 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ /** Category keys for translation sets (e.g., "errors", "messages", "labels", "prompts"). */
16
17
  type TranslationCategory = keyof Required<Translations>;
18
+ /** Generic type for translation keys within a specific category. */
17
19
  type TranslationKey<T extends TranslationCategory> = keyof Required<Translations>[T];
20
+ /** Record type representing a complete set of translations for a specific category. */
18
21
  type TranslationSet<T extends TranslationCategory> = Record<TranslationKey<T>, string>;
22
+ /** Keys for error translation messages. */
19
23
  type ErrorKey = keyof Required<Translations>["errors"];
24
+ /** Keys for informational message translations. */
20
25
  type MessageKey = keyof Required<Translations>["messages"];
26
+ /** Keys for UI label translations. */
21
27
  type LabelKey = keyof Required<Translations>["labels"];
28
+ /** Keys for prompt/instruction translations. */
22
29
  type PromptKey = keyof Required<Translations>["prompts"];
30
+ /** Configuration type for translations, mapping locale identifiers to partial translation objects. */
23
31
  type TranslationsConfig = Partial<Record<string, Partial<Translations>>>;
32
+ /** Complete translations interface containing all translation categories and their keys. */
24
33
  type Translations = {
34
+ /** Error message translations. */
25
35
  errors?: {
36
+ /** Translation for when a user is not found. */
26
37
  userNotFound?: string;
38
+ /** Translation for incorrect password. */
27
39
  wrongPassword?: string;
40
+ /** Translation for invalid email address. */
28
41
  invalidEmail?: string;
42
+ /** Translation for disabled user account. */
29
43
  userDisabled?: string;
44
+ /** Translation for unverified email address. */
45
+ unverifiedEmail?: string;
46
+ /** Translation for network request failure. */
30
47
  networkRequestFailed?: string;
48
+ /** Translation for too many requests. */
31
49
  tooManyRequests?: string;
50
+ /** Translation for email already in use. */
32
51
  emailAlreadyInUse?: string;
52
+ /** Translation for missing verification code. */
53
+ missingVerificationCode?: string;
54
+ /** Translation for invalid credentials. */
55
+ invalidCredential?: string;
56
+ /** Translation for weak password. */
33
57
  weakPassword?: string;
58
+ /** Translation for operation not allowed. */
34
59
  operationNotAllowed?: string;
60
+ /** Translation for invalid phone number. */
35
61
  invalidPhoneNumber?: string;
62
+ /** Translation for missing phone number. */
36
63
  missingPhoneNumber?: string;
64
+ /** Translation for SMS quota exceeded. */
37
65
  quotaExceeded?: string;
66
+ /** Translation for expired verification code. */
38
67
  codeExpired?: string;
68
+ /** Translation for reCAPTCHA check failure. */
39
69
  captchaCheckFailed?: string;
70
+ /** Translation for missing verification ID. */
40
71
  missingVerificationId?: string;
72
+ /** Translation for missing email address. */
41
73
  missingEmail?: string;
74
+ /** Translation for required display name. */
42
75
  displayNameRequired?: string;
76
+ /** Translation for invalid action code. */
43
77
  invalidActionCode?: string;
78
+ /** Translation for credential already in use. */
44
79
  credentialAlreadyInUse?: string;
80
+ /** Translation for operation requiring recent login. */
45
81
  requiresRecentLogin?: string;
82
+ /** Translation for provider already linked. */
46
83
  providerAlreadyLinked?: string;
84
+ /** Translation for invalid verification code. */
47
85
  invalidVerificationCode?: string;
86
+ /** Translation for unknown error. */
48
87
  unknownError?: string;
88
+ /** Translation for popup closed by user. */
49
89
  popupClosed?: string;
90
+ /** Translation for account existing with different credential. */
50
91
  accountExistsWithDifferentCredential?: string;
92
+ /** Translation for second factor already in use. */
51
93
  secondFactorAlreadyInUse?: string;
52
94
  };
95
+ /** Informational message translations. */
53
96
  messages?: {
97
+ /** Translation for password reset email sent confirmation. */
54
98
  passwordResetEmailSent?: string;
99
+ /** Translation for sign-in link sent confirmation. */
55
100
  signInLinkSent?: string;
101
+ /** Translation for verification code required first. */
56
102
  verificationCodeFirst?: string;
103
+ /** Translation for checking email for reset instructions. */
57
104
  checkEmailForReset?: string;
105
+ /** Translation for "or" divider text. */
58
106
  dividerOr?: string;
107
+ /** Translation for terms and privacy policy notice. */
59
108
  termsAndPrivacy?: string;
109
+ /** Translation for MFA SMS assertion prompt message. */
110
+ mfaSmsAssertionPrompt?: string;
60
111
  };
112
+ /** UI label translations. */
61
113
  labels?: {
114
+ /** Translation for email address label. */
62
115
  emailAddress?: string;
116
+ /** Translation for password label. */
63
117
  password?: string;
118
+ /** Translation for display name label. */
64
119
  displayName?: string;
120
+ /** Translation for forgot password link. */
65
121
  forgotPassword?: string;
122
+ /** Translation for sign up button/link. */
66
123
  signUp?: string;
124
+ /** Translation for sign in button/link. */
67
125
  signIn?: string;
126
+ /** Translation for reset password button. */
68
127
  resetPassword?: string;
128
+ /** Translation for create account button. */
69
129
  createAccount?: string;
130
+ /** Translation for back to sign in link. */
70
131
  backToSignIn?: string;
132
+ /** Translation for sign in with phone button. */
71
133
  signInWithPhone?: string;
134
+ /** Translation for phone number label. */
72
135
  phoneNumber?: string;
136
+ /** Translation for verification code label. */
73
137
  verificationCode?: string;
138
+ /** Translation for send code button. */
74
139
  sendCode?: string;
140
+ /** Translation for verify code button. */
75
141
  verifyCode?: string;
142
+ /** Translation for sign in with Google button. */
76
143
  signInWithGoogle?: string;
144
+ /** Translation for sign in with Facebook button. */
77
145
  signInWithFacebook?: string;
146
+ /** Translation for sign in with Apple button. */
78
147
  signInWithApple?: string;
148
+ /** Translation for sign in with Twitter/X button. */
79
149
  signInWithTwitter?: string;
150
+ /** Translation for sign in with Microsoft button. */
80
151
  signInWithMicrosoft?: string;
152
+ /** Translation for sign in with GitHub button. */
81
153
  signInWithGitHub?: string;
154
+ /** Translation for sign in with email link button. */
82
155
  signInWithEmailLink?: string;
156
+ /** Translation for send sign-in link button. */
83
157
  sendSignInLink?: string;
158
+ /** Translation for terms of service link. */
84
159
  termsOfService?: string;
160
+ /** Translation for privacy policy link. */
85
161
  privacyPolicy?: string;
162
+ /** Translation for resend code button. */
86
163
  resendCode?: string;
164
+ /** Translation for sending state text. */
87
165
  sending?: string;
166
+ /** Translation for multi-factor enrollment label. */
88
167
  multiFactorEnrollment?: string;
168
+ /** Translation for multi-factor assertion label. */
169
+ multiFactorAssertion?: string;
170
+ /** Translation for TOTP verification label. */
89
171
  mfaTotpVerification?: string;
172
+ /** Translation for SMS verification label. */
90
173
  mfaSmsVerification?: string;
174
+ /** Translation for generate QR code button. */
91
175
  generateQrCode?: string;
92
176
  };
177
+ /** Prompt and instruction translations. */
93
178
  prompts?: {
179
+ /** Translation for "don't have an account" prompt. */
94
180
  noAccount?: string;
181
+ /** Translation for "already have an account" prompt. */
95
182
  haveAccount?: string;
183
+ /** Translation for enter email to reset password prompt. */
96
184
  enterEmailToReset?: string;
185
+ /** Translation for sign in to account prompt. */
97
186
  signInToAccount?: string;
187
+ /** Translation for enter details to create account prompt. */
98
188
  enterDetailsToCreate?: string;
189
+ /** Translation for SMS verification code prompt. */
190
+ smsVerificationPrompt?: string;
191
+ /** Translation for enter phone number prompt. */
99
192
  enterPhoneNumber?: string;
193
+ /** Translation for enter verification code prompt. */
100
194
  enterVerificationCode?: string;
195
+ /** Translation for enter email for link prompt. */
101
196
  enterEmailForLink?: string;
197
+ /** Translation for MFA enrollment prompt. */
102
198
  mfaEnrollmentPrompt?: string;
199
+ /** Translation for MFA assertion prompt. */
200
+ mfaAssertionPrompt?: string;
201
+ /** Translation for MFA assertion factor selection prompt. */
202
+ mfaAssertionFactorPrompt?: string;
203
+ /** Translation for TOTP QR code prompt. */
204
+ mfaTotpQrCodePrompt?: string;
205
+ /** Translation for TOTP enrollment verification prompt. */
206
+ mfaTotpEnrollmentVerificationPrompt?: string;
103
207
  };
104
208
  };
105
209
 
@@ -119,11 +223,15 @@ type Translations = {
119
223
  * limitations under the License.
120
224
  */
121
225
 
226
+ /** Maps Firebase authentication error codes to translation keys. */
122
227
  declare const ERROR_CODE_MAP: {
123
228
  "auth/user-not-found": "userNotFound";
124
229
  "auth/wrong-password": "wrongPassword";
125
230
  "auth/invalid-email": "invalidEmail";
231
+ "auth/unverified-email": "unverifiedEmail";
126
232
  "auth/user-disabled": "userDisabled";
233
+ "auth/missing-code": "missingVerificationCode";
234
+ "auth/invalid-credential": "invalidCredential";
127
235
  "auth/network-request-failed": "networkRequestFailed";
128
236
  "auth/too-many-requests": "tooManyRequests";
129
237
  "auth/email-already-in-use": "emailAlreadyInUse";
@@ -145,8 +253,21 @@ declare const ERROR_CODE_MAP: {
145
253
  "auth/display-name-required": "displayNameRequired";
146
254
  "auth/second-factor-already-in-use": "secondFactorAlreadyInUse";
147
255
  };
256
+ /** Firebase authentication error code type. */
148
257
  type ErrorCode = keyof typeof ERROR_CODE_MAP;
149
- declare function getTranslation<T extends TranslationCategory>(locale: RegisteredLocale, category: T, key: TranslationKey<T>): string;
258
+ /**
259
+ * Retrieves a translation string for a given locale, category, and key.
260
+ *
261
+ * Falls back to the locale's fallback locale or English US if the translation is not found.
262
+ * Supports string replacements using {placeholder} syntax.
263
+ *
264
+ * @param locale - The registered locale to get the translation from.
265
+ * @param category - The translation category (e.g., "errors", "labels").
266
+ * @param key - The translation key within the category.
267
+ * @param replacements - Optional object with replacement values for placeholders in the translation string.
268
+ * @returns The translated string, or an empty string if not found.
269
+ */
270
+ declare function getTranslation<T extends TranslationCategory>(locale: RegisteredLocale, category: T, key: TranslationKey<T>, replacements?: Record<string, string>): string;
150
271
 
151
272
  /**
152
273
  * Copyright 2025 Google LLC
@@ -164,12 +285,26 @@ declare function getTranslation<T extends TranslationCategory>(locale: Registere
164
285
  * limitations under the License.
165
286
  */
166
287
 
288
+ /** Locale identifier string. Supports BCP 47 format (e.g., "en-US") or any string. */
167
289
  type Locale = "en-US" | `${string}-${string}` | string;
290
+ /**
291
+ * Registers a locale with its translations and optional fallback locale.
292
+ *
293
+ * @param locale - The locale identifier (e.g., "en-US", "fr-FR").
294
+ * @param translations - The translation object for this locale.
295
+ * @param fallback - Optional fallback locale to use when a translation is missing.
296
+ * @returns A registered locale object.
297
+ */
168
298
  declare function registerLocale(locale: Locale, translations: Translations, fallback?: RegisteredLocale): RegisteredLocale;
299
+ /** Pre-registered English US locale with default translations. */
169
300
  declare const enUs: RegisteredLocale;
301
+ /** A registered locale with its translations and optional fallback. */
170
302
  type RegisteredLocale = {
303
+ /** The locale identifier. */
171
304
  locale: Locale;
305
+ /** The translation object for this locale. */
172
306
  translations: Translations;
307
+ /** Optional fallback locale to use when a translation is missing. */
173
308
  fallback?: RegisteredLocale;
174
309
  };
175
310
 
package/dist/index.d.ts CHANGED
@@ -13,93 +13,197 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ /** Category keys for translation sets (e.g., "errors", "messages", "labels", "prompts"). */
16
17
  type TranslationCategory = keyof Required<Translations>;
18
+ /** Generic type for translation keys within a specific category. */
17
19
  type TranslationKey<T extends TranslationCategory> = keyof Required<Translations>[T];
20
+ /** Record type representing a complete set of translations for a specific category. */
18
21
  type TranslationSet<T extends TranslationCategory> = Record<TranslationKey<T>, string>;
22
+ /** Keys for error translation messages. */
19
23
  type ErrorKey = keyof Required<Translations>["errors"];
24
+ /** Keys for informational message translations. */
20
25
  type MessageKey = keyof Required<Translations>["messages"];
26
+ /** Keys for UI label translations. */
21
27
  type LabelKey = keyof Required<Translations>["labels"];
28
+ /** Keys for prompt/instruction translations. */
22
29
  type PromptKey = keyof Required<Translations>["prompts"];
30
+ /** Configuration type for translations, mapping locale identifiers to partial translation objects. */
23
31
  type TranslationsConfig = Partial<Record<string, Partial<Translations>>>;
32
+ /** Complete translations interface containing all translation categories and their keys. */
24
33
  type Translations = {
34
+ /** Error message translations. */
25
35
  errors?: {
36
+ /** Translation for when a user is not found. */
26
37
  userNotFound?: string;
38
+ /** Translation for incorrect password. */
27
39
  wrongPassword?: string;
40
+ /** Translation for invalid email address. */
28
41
  invalidEmail?: string;
42
+ /** Translation for disabled user account. */
29
43
  userDisabled?: string;
44
+ /** Translation for unverified email address. */
45
+ unverifiedEmail?: string;
46
+ /** Translation for network request failure. */
30
47
  networkRequestFailed?: string;
48
+ /** Translation for too many requests. */
31
49
  tooManyRequests?: string;
50
+ /** Translation for email already in use. */
32
51
  emailAlreadyInUse?: string;
52
+ /** Translation for missing verification code. */
53
+ missingVerificationCode?: string;
54
+ /** Translation for invalid credentials. */
55
+ invalidCredential?: string;
56
+ /** Translation for weak password. */
33
57
  weakPassword?: string;
58
+ /** Translation for operation not allowed. */
34
59
  operationNotAllowed?: string;
60
+ /** Translation for invalid phone number. */
35
61
  invalidPhoneNumber?: string;
62
+ /** Translation for missing phone number. */
36
63
  missingPhoneNumber?: string;
64
+ /** Translation for SMS quota exceeded. */
37
65
  quotaExceeded?: string;
66
+ /** Translation for expired verification code. */
38
67
  codeExpired?: string;
68
+ /** Translation for reCAPTCHA check failure. */
39
69
  captchaCheckFailed?: string;
70
+ /** Translation for missing verification ID. */
40
71
  missingVerificationId?: string;
72
+ /** Translation for missing email address. */
41
73
  missingEmail?: string;
74
+ /** Translation for required display name. */
42
75
  displayNameRequired?: string;
76
+ /** Translation for invalid action code. */
43
77
  invalidActionCode?: string;
78
+ /** Translation for credential already in use. */
44
79
  credentialAlreadyInUse?: string;
80
+ /** Translation for operation requiring recent login. */
45
81
  requiresRecentLogin?: string;
82
+ /** Translation for provider already linked. */
46
83
  providerAlreadyLinked?: string;
84
+ /** Translation for invalid verification code. */
47
85
  invalidVerificationCode?: string;
86
+ /** Translation for unknown error. */
48
87
  unknownError?: string;
88
+ /** Translation for popup closed by user. */
49
89
  popupClosed?: string;
90
+ /** Translation for account existing with different credential. */
50
91
  accountExistsWithDifferentCredential?: string;
92
+ /** Translation for second factor already in use. */
51
93
  secondFactorAlreadyInUse?: string;
52
94
  };
95
+ /** Informational message translations. */
53
96
  messages?: {
97
+ /** Translation for password reset email sent confirmation. */
54
98
  passwordResetEmailSent?: string;
99
+ /** Translation for sign-in link sent confirmation. */
55
100
  signInLinkSent?: string;
101
+ /** Translation for verification code required first. */
56
102
  verificationCodeFirst?: string;
103
+ /** Translation for checking email for reset instructions. */
57
104
  checkEmailForReset?: string;
105
+ /** Translation for "or" divider text. */
58
106
  dividerOr?: string;
107
+ /** Translation for terms and privacy policy notice. */
59
108
  termsAndPrivacy?: string;
109
+ /** Translation for MFA SMS assertion prompt message. */
110
+ mfaSmsAssertionPrompt?: string;
60
111
  };
112
+ /** UI label translations. */
61
113
  labels?: {
114
+ /** Translation for email address label. */
62
115
  emailAddress?: string;
116
+ /** Translation for password label. */
63
117
  password?: string;
118
+ /** Translation for display name label. */
64
119
  displayName?: string;
120
+ /** Translation for forgot password link. */
65
121
  forgotPassword?: string;
122
+ /** Translation for sign up button/link. */
66
123
  signUp?: string;
124
+ /** Translation for sign in button/link. */
67
125
  signIn?: string;
126
+ /** Translation for reset password button. */
68
127
  resetPassword?: string;
128
+ /** Translation for create account button. */
69
129
  createAccount?: string;
130
+ /** Translation for back to sign in link. */
70
131
  backToSignIn?: string;
132
+ /** Translation for sign in with phone button. */
71
133
  signInWithPhone?: string;
134
+ /** Translation for phone number label. */
72
135
  phoneNumber?: string;
136
+ /** Translation for verification code label. */
73
137
  verificationCode?: string;
138
+ /** Translation for send code button. */
74
139
  sendCode?: string;
140
+ /** Translation for verify code button. */
75
141
  verifyCode?: string;
142
+ /** Translation for sign in with Google button. */
76
143
  signInWithGoogle?: string;
144
+ /** Translation for sign in with Facebook button. */
77
145
  signInWithFacebook?: string;
146
+ /** Translation for sign in with Apple button. */
78
147
  signInWithApple?: string;
148
+ /** Translation for sign in with Twitter/X button. */
79
149
  signInWithTwitter?: string;
150
+ /** Translation for sign in with Microsoft button. */
80
151
  signInWithMicrosoft?: string;
152
+ /** Translation for sign in with GitHub button. */
81
153
  signInWithGitHub?: string;
154
+ /** Translation for sign in with email link button. */
82
155
  signInWithEmailLink?: string;
156
+ /** Translation for send sign-in link button. */
83
157
  sendSignInLink?: string;
158
+ /** Translation for terms of service link. */
84
159
  termsOfService?: string;
160
+ /** Translation for privacy policy link. */
85
161
  privacyPolicy?: string;
162
+ /** Translation for resend code button. */
86
163
  resendCode?: string;
164
+ /** Translation for sending state text. */
87
165
  sending?: string;
166
+ /** Translation for multi-factor enrollment label. */
88
167
  multiFactorEnrollment?: string;
168
+ /** Translation for multi-factor assertion label. */
169
+ multiFactorAssertion?: string;
170
+ /** Translation for TOTP verification label. */
89
171
  mfaTotpVerification?: string;
172
+ /** Translation for SMS verification label. */
90
173
  mfaSmsVerification?: string;
174
+ /** Translation for generate QR code button. */
91
175
  generateQrCode?: string;
92
176
  };
177
+ /** Prompt and instruction translations. */
93
178
  prompts?: {
179
+ /** Translation for "don't have an account" prompt. */
94
180
  noAccount?: string;
181
+ /** Translation for "already have an account" prompt. */
95
182
  haveAccount?: string;
183
+ /** Translation for enter email to reset password prompt. */
96
184
  enterEmailToReset?: string;
185
+ /** Translation for sign in to account prompt. */
97
186
  signInToAccount?: string;
187
+ /** Translation for enter details to create account prompt. */
98
188
  enterDetailsToCreate?: string;
189
+ /** Translation for SMS verification code prompt. */
190
+ smsVerificationPrompt?: string;
191
+ /** Translation for enter phone number prompt. */
99
192
  enterPhoneNumber?: string;
193
+ /** Translation for enter verification code prompt. */
100
194
  enterVerificationCode?: string;
195
+ /** Translation for enter email for link prompt. */
101
196
  enterEmailForLink?: string;
197
+ /** Translation for MFA enrollment prompt. */
102
198
  mfaEnrollmentPrompt?: string;
199
+ /** Translation for MFA assertion prompt. */
200
+ mfaAssertionPrompt?: string;
201
+ /** Translation for MFA assertion factor selection prompt. */
202
+ mfaAssertionFactorPrompt?: string;
203
+ /** Translation for TOTP QR code prompt. */
204
+ mfaTotpQrCodePrompt?: string;
205
+ /** Translation for TOTP enrollment verification prompt. */
206
+ mfaTotpEnrollmentVerificationPrompt?: string;
103
207
  };
104
208
  };
105
209
 
@@ -119,11 +223,15 @@ type Translations = {
119
223
  * limitations under the License.
120
224
  */
121
225
 
226
+ /** Maps Firebase authentication error codes to translation keys. */
122
227
  declare const ERROR_CODE_MAP: {
123
228
  "auth/user-not-found": "userNotFound";
124
229
  "auth/wrong-password": "wrongPassword";
125
230
  "auth/invalid-email": "invalidEmail";
231
+ "auth/unverified-email": "unverifiedEmail";
126
232
  "auth/user-disabled": "userDisabled";
233
+ "auth/missing-code": "missingVerificationCode";
234
+ "auth/invalid-credential": "invalidCredential";
127
235
  "auth/network-request-failed": "networkRequestFailed";
128
236
  "auth/too-many-requests": "tooManyRequests";
129
237
  "auth/email-already-in-use": "emailAlreadyInUse";
@@ -145,8 +253,21 @@ declare const ERROR_CODE_MAP: {
145
253
  "auth/display-name-required": "displayNameRequired";
146
254
  "auth/second-factor-already-in-use": "secondFactorAlreadyInUse";
147
255
  };
256
+ /** Firebase authentication error code type. */
148
257
  type ErrorCode = keyof typeof ERROR_CODE_MAP;
149
- declare function getTranslation<T extends TranslationCategory>(locale: RegisteredLocale, category: T, key: TranslationKey<T>): string;
258
+ /**
259
+ * Retrieves a translation string for a given locale, category, and key.
260
+ *
261
+ * Falls back to the locale's fallback locale or English US if the translation is not found.
262
+ * Supports string replacements using {placeholder} syntax.
263
+ *
264
+ * @param locale - The registered locale to get the translation from.
265
+ * @param category - The translation category (e.g., "errors", "labels").
266
+ * @param key - The translation key within the category.
267
+ * @param replacements - Optional object with replacement values for placeholders in the translation string.
268
+ * @returns The translated string, or an empty string if not found.
269
+ */
270
+ declare function getTranslation<T extends TranslationCategory>(locale: RegisteredLocale, category: T, key: TranslationKey<T>, replacements?: Record<string, string>): string;
150
271
 
151
272
  /**
152
273
  * Copyright 2025 Google LLC
@@ -164,12 +285,26 @@ declare function getTranslation<T extends TranslationCategory>(locale: Registere
164
285
  * limitations under the License.
165
286
  */
166
287
 
288
+ /** Locale identifier string. Supports BCP 47 format (e.g., "en-US") or any string. */
167
289
  type Locale = "en-US" | `${string}-${string}` | string;
290
+ /**
291
+ * Registers a locale with its translations and optional fallback locale.
292
+ *
293
+ * @param locale - The locale identifier (e.g., "en-US", "fr-FR").
294
+ * @param translations - The translation object for this locale.
295
+ * @param fallback - Optional fallback locale to use when a translation is missing.
296
+ * @returns A registered locale object.
297
+ */
168
298
  declare function registerLocale(locale: Locale, translations: Translations, fallback?: RegisteredLocale): RegisteredLocale;
299
+ /** Pre-registered English US locale with default translations. */
169
300
  declare const enUs: RegisteredLocale;
301
+ /** A registered locale with its translations and optional fallback. */
170
302
  type RegisteredLocale = {
303
+ /** The locale identifier. */
171
304
  locale: Locale;
305
+ /** The translation object for this locale. */
172
306
  translations: Translations;
307
+ /** Optional fallback locale to use when a translation is missing. */
173
308
  fallback?: RegisteredLocale;
174
309
  };
175
310
 
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var a={errors:{userNotFound:"No account found with this email address",wrongPassword:"Incorrect password",invalidEmail:"Please enter a valid email address",userDisabled:"This account has been disabled",networkRequestFailed:"Unable to connect to the server. Please check your internet connection",tooManyRequests:"Too many failed attempts. Please try again later",emailAlreadyInUse:"An account already exists with this email",weakPassword:"Password should be at least 8 characters",operationNotAllowed:"Email/password accounts are not enabled. Please contact support.",invalidPhoneNumber:"The phone number is invalid",missingPhoneNumber:"Please provide a phone number",quotaExceeded:"SMS quota exceeded. Please try again later",codeExpired:"The verification code has expired",captchaCheckFailed:"reCAPTCHA verification failed. Please try again.",missingVerificationId:"Please complete the reCAPTCHA verification first.",missingEmail:"Please provide an email address",invalidActionCode:"The password reset link is invalid or has expired",credentialAlreadyInUse:"An account already exists with this email. Please sign in with that account.",requiresRecentLogin:"This operation requires a recent login. Please sign in again.",providerAlreadyLinked:"This phone number is already linked to another account",invalidVerificationCode:"Invalid verification code. Please try again",unknownError:"An unexpected error occurred",popupClosed:"The sign-in popup was closed. Please try again.",accountExistsWithDifferentCredential:"An account already exists with this email. Please sign in with the original provider.",displayNameRequired:"Please provide a display name",secondFactorAlreadyInUse:"This phone number is already enrolled with this account."},messages:{passwordResetEmailSent:"Password reset email sent successfully",signInLinkSent:"Sign-in link sent successfully",verificationCodeFirst:"Please request a verification code first",checkEmailForReset:"Check your email for password reset instructions",dividerOr:"or",termsAndPrivacy:"By continuing, you agree to our {tos} and {privacy}."},labels:{emailAddress:"Email Address",password:"Password",displayName:"Display Name",forgotPassword:"Forgot Password?",signUp:"Sign Up",signIn:"Sign In",resetPassword:"Reset Password",createAccount:"Create Account",backToSignIn:"Back to Sign In",signInWithPhone:"Sign in with Phone",phoneNumber:"Phone Number",verificationCode:"Verification Code",sendCode:"Send Code",verifyCode:"Verify Code",signInWithGoogle:"Sign in with Google",signInWithFacebook:"Sign in with Facebook",signInWithApple:"Sign in with Apple",signInWithMicrosoft:"Sign in with Microsoft",signInWithGitHub:"Sign in with GitHub",signInWithTwitter:"Sign in with Twitter",signInWithEmailLink:"Sign in with Email Link",sendSignInLink:"Send Sign-in Link",termsOfService:"Terms of Service",privacyPolicy:"Privacy Policy",resendCode:"Resend Code",sending:"Sending...",multiFactorEnrollment:"Multi-factor Enrollment",mfaTotpVerification:"TOTP Verification",mfaSmsVerification:"SMS Verification",generateQrCode:"Generate QR Code"},prompts:{noAccount:"Don't have an account?",haveAccount:"Already have an account?",enterEmailToReset:"Enter your email address to reset your password",signInToAccount:"Sign in to your account",enterDetailsToCreate:"Enter your details to create a new account",enterPhoneNumber:"Enter your phone number",enterVerificationCode:"Enter the verification code",enterEmailForLink:"Enter your email to receive a sign-in link",mfaEnrollmentPrompt:"Select a new multi-factor enrollment method"}};var h={"auth/user-not-found":"userNotFound","auth/wrong-password":"wrongPassword","auth/invalid-email":"invalidEmail","auth/user-disabled":"userDisabled","auth/network-request-failed":"networkRequestFailed","auth/too-many-requests":"tooManyRequests","auth/email-already-in-use":"emailAlreadyInUse","auth/weak-password":"weakPassword","auth/operation-not-allowed":"operationNotAllowed","auth/invalid-phone-number":"invalidPhoneNumber","auth/missing-phone-number":"missingPhoneNumber","auth/quota-exceeded":"quotaExceeded","auth/code-expired":"codeExpired","auth/captcha-check-failed":"captchaCheckFailed","auth/missing-verification-id":"missingVerificationId","auth/missing-email":"missingEmail","auth/invalid-action-code":"invalidActionCode","auth/credential-already-in-use":"credentialAlreadyInUse","auth/requires-recent-login":"requiresRecentLogin","auth/provider-already-linked":"providerAlreadyLinked","auth/invalid-verification-code":"invalidVerificationCode","auth/account-exists-with-different-credential":"accountExistsWithDifferentCredential","auth/display-name-required":"displayNameRequired","auth/second-factor-already-in-use":"secondFactorAlreadyInUse"};function o(e,i,n){let t=e.translations[i]?.[n];if(t)return t;if(e.fallback){let r=o(e.fallback,i,n);if(r)return r}return a[i][n]}function s(e,i,n){return {locale:e,translations:i,fallback:n}}var g=s("en-US",a);export{h as ERROR_CODE_MAP,g as enUs,o as getTranslation,s as registerLocale};//# sourceMappingURL=index.js.map
1
+ var o={errors:{userNotFound:"No account found with this email address",wrongPassword:"Incorrect password",invalidEmail:"Please enter a valid email address",userDisabled:"This account has been disabled",networkRequestFailed:"Unable to connect to the server. Please check your internet connection",tooManyRequests:"Too many failed attempts. Please try again later",missingVerificationCode:"Please enter the verification code",emailAlreadyInUse:"An account already exists with this email",invalidCredential:"The provided credentials are invalid.",weakPassword:"Password should be at least 8 characters",unverifiedEmail:"Please verify your email address to continue.",operationNotAllowed:"This operation is not allowed. Please contact support.",invalidPhoneNumber:"The phone number is invalid",missingPhoneNumber:"Please provide a phone number",quotaExceeded:"SMS quota exceeded. Please try again later",codeExpired:"The verification code has expired",captchaCheckFailed:"reCAPTCHA verification failed. Please try again.",missingVerificationId:"Please complete the reCAPTCHA verification first.",missingEmail:"Please provide an email address",invalidActionCode:"The password reset link is invalid or has expired",credentialAlreadyInUse:"An account already exists with this email. Please sign in with that account.",requiresRecentLogin:"This operation requires a recent login. Please sign in again.",providerAlreadyLinked:"This phone number is already linked to another account",invalidVerificationCode:"Invalid verification code. Please try again",unknownError:"An unexpected error occurred",popupClosed:"The sign-in popup was closed. Please try again.",accountExistsWithDifferentCredential:"An account already exists with this email. Please sign in with the original provider.",displayNameRequired:"Please provide a display name",secondFactorAlreadyInUse:"This phone number is already enrolled with this account."},messages:{passwordResetEmailSent:"Password reset email sent successfully",signInLinkSent:"Sign-in link sent successfully",verificationCodeFirst:"Please request a verification code first",checkEmailForReset:"Check your email for password reset instructions",dividerOr:"or",termsAndPrivacy:"By continuing, you agree to our {tos} and {privacy}.",mfaSmsAssertionPrompt:"A verification code will be sent to {phoneNumber} to complete the authentication process."},labels:{emailAddress:"Email Address",password:"Password",displayName:"Display Name",forgotPassword:"Forgot Password?",signUp:"Sign Up",signIn:"Sign In",resetPassword:"Reset Password",createAccount:"Create Account",backToSignIn:"Back to Sign In",signInWithPhone:"Sign in with Phone",phoneNumber:"Phone Number",verificationCode:"Verification Code",sendCode:"Send Code",verifyCode:"Verify Code",signInWithGoogle:"Sign in with Google",signInWithFacebook:"Sign in with Facebook",signInWithApple:"Sign in with Apple",signInWithMicrosoft:"Sign in with Microsoft",signInWithGitHub:"Sign in with GitHub",signInWithTwitter:"Sign in with X",signInWithEmailLink:"Sign in with Email Link",sendSignInLink:"Send Sign-in Link",termsOfService:"Terms of Service",privacyPolicy:"Privacy Policy",resendCode:"Resend Code",sending:"Sending...",multiFactorEnrollment:"Multi-factor Enrollment",multiFactorAssertion:"Multi-factor Authentication",mfaTotpVerification:"TOTP Verification",mfaSmsVerification:"SMS Verification",generateQrCode:"Generate QR Code"},prompts:{noAccount:"Don't have an account?",haveAccount:"Already have an account?",enterEmailToReset:"Enter your email address to reset your password",signInToAccount:"Sign in to your account",smsVerificationPrompt:"Enter the verification code sent to your phone number",enterDetailsToCreate:"Enter your details to create a new account",enterPhoneNumber:"Enter your phone number",enterVerificationCode:"Enter the verification code",enterEmailForLink:"Enter your email to receive a sign-in link",mfaEnrollmentPrompt:"Select a new multi-factor enrollment method",mfaAssertionPrompt:"Please complete the multi-factor authentication process",mfaAssertionFactorPrompt:"Please choose a multi-factor authentication method",mfaTotpQrCodePrompt:"Scan this QR code with your authenticator app",mfaTotpEnrollmentVerificationPrompt:"Add the code generated by your authenticator app"}};var p={"auth/user-not-found":"userNotFound","auth/wrong-password":"wrongPassword","auth/invalid-email":"invalidEmail","auth/unverified-email":"unverifiedEmail","auth/user-disabled":"userDisabled","auth/missing-code":"missingVerificationCode","auth/invalid-credential":"invalidCredential","auth/network-request-failed":"networkRequestFailed","auth/too-many-requests":"tooManyRequests","auth/email-already-in-use":"emailAlreadyInUse","auth/weak-password":"weakPassword","auth/operation-not-allowed":"operationNotAllowed","auth/invalid-phone-number":"invalidPhoneNumber","auth/missing-phone-number":"missingPhoneNumber","auth/quota-exceeded":"quotaExceeded","auth/code-expired":"codeExpired","auth/captcha-check-failed":"captchaCheckFailed","auth/missing-verification-id":"missingVerificationId","auth/missing-email":"missingEmail","auth/invalid-action-code":"invalidActionCode","auth/credential-already-in-use":"credentialAlreadyInUse","auth/requires-recent-login":"requiresRecentLogin","auth/provider-already-linked":"providerAlreadyLinked","auth/invalid-verification-code":"invalidVerificationCode","auth/account-exists-with-different-credential":"accountExistsWithDifferentCredential","auth/display-name-required":"displayNameRequired","auth/second-factor-already-in-use":"secondFactorAlreadyInUse"};function d(i,t,n,r){let s=i.translations[t]?.[n],e;if(s)e=s;else if(i.fallback){let a=d(i.fallback,t,n);a&&(e=a);}else e=o[t][n];return r&&(e=e?.replace(/{(\w+)}/g,(a,l)=>r[l]||a)),e||""}function c(i,t,n){return {locale:i,translations:t,fallback:n}}var y=c("en-US",o);export{p as ERROR_CODE_MAP,y as enUs,d as getTranslation,c as registerLocale};//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/locales/en-us.ts","../src/mapping.ts","../src/index.ts"],"names":["enUS","ERROR_CODE_MAP","getTranslation","locale","category","key","translatedString","fallbackTranslation","registerLocale","translations","fallback","enUs"],"mappings":"AAmBO,IAAMA,CAAAA,CAAO,CAClB,MAAA,CAAQ,CACN,YAAA,CAAc,0CAAA,CACd,aAAA,CAAe,oBAAA,CACf,YAAA,CAAc,oCAAA,CACd,YAAA,CAAc,gCAAA,CACd,qBAAsB,wEAAA,CACtB,eAAA,CAAiB,kDAAA,CACjB,iBAAA,CAAmB,2CAAA,CACnB,YAAA,CAAc,0CAAA,CACd,mBAAA,CAAqB,kEAAA,CACrB,kBAAA,CAAoB,6BAAA,CACpB,kBAAA,CAAoB,+BAAA,CACpB,aAAA,CAAe,4CAAA,CACf,WAAA,CAAa,oCACb,kBAAA,CAAoB,kDAAA,CACpB,qBAAA,CAAuB,mDAAA,CACvB,YAAA,CAAc,iCAAA,CACd,iBAAA,CAAmB,mDAAA,CACnB,sBAAA,CAAwB,8EAAA,CACxB,mBAAA,CAAqB,+DAAA,CACrB,qBAAA,CAAuB,wDAAA,CACvB,uBAAA,CAAyB,6CAAA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kB,CAClB,OAAO,CACL,MAAA,CAAAP,CAAAA,CACA,aAAAM,CAAAA,CACA,QAAA,CAAAC,CACF,CACF,CAEO,IAAMC,CAAAA,CAAOH,CAAAA,CAAe,QAASR,CAAI","file":"index.js","sourcesContent":["/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type Translations } from \"../types\";\n\n// TODO: Should this be required or optional?\nexport const enUS = {\n errors: {\n userNotFound: \"No account found with this email address\",\n wrongPassword: \"Incorrect password\",\n invalidEmail: \"Please enter a valid email address\",\n userDisabled: \"This account has been disabled\",\n networkRequestFailed: \"Unable to connect to the server. Please check your internet connection\",\n tooManyRequests: \"Too many failed attempts. Please try again later\",\n emailAlreadyInUse: \"An account already exists with this email\",\n weakPassword: \"Password should be at least 8 characters\",\n operationNotAllowed: \"Email/password accounts are not enabled. Please contact support.\",\n invalidPhoneNumber: \"The phone number is invalid\",\n missingPhoneNumber: \"Please provide a phone number\",\n quotaExceeded: \"SMS quota exceeded. Please try again later\",\n codeExpired: \"The verification code has expired\",\n captchaCheckFailed: \"reCAPTCHA verification failed. Please try again.\",\n missingVerificationId: \"Please complete the reCAPTCHA verification first.\",\n missingEmail: \"Please provide an email address\",\n invalidActionCode: \"The password reset link is invalid or has expired\",\n credentialAlreadyInUse: \"An account already exists with this email. Please sign in with that account.\",\n requiresRecentLogin: \"This operation requires a recent login. Please sign in again.\",\n providerAlreadyLinked: \"This phone number is already linked to another account\",\n invalidVerificationCode: \"Invalid verification code. Please try again\",\n unknownError: \"An unexpected error occurred\",\n popupClosed: \"The sign-in popup was closed. Please try again.\",\n accountExistsWithDifferentCredential:\n \"An account already exists with this email. Please sign in with the original provider.\",\n displayNameRequired: \"Please provide a display name\",\n secondFactorAlreadyInUse: \"This phone number is already enrolled with this account.\",\n },\n messages: {\n passwordResetEmailSent: \"Password reset email sent successfully\",\n signInLinkSent: \"Sign-in link sent successfully\",\n verificationCodeFirst: \"Please request a verification code first\",\n checkEmailForReset: \"Check your email for password reset instructions\",\n dividerOr: \"or\",\n termsAndPrivacy: \"By continuing, you agree to our {tos} and {privacy}.\",\n },\n labels: {\n emailAddress: \"Email Address\",\n password: \"Password\",\n displayName: \"Display Name\",\n forgotPassword: \"Forgot Password?\",\n signUp: \"Sign Up\",\n signIn: \"Sign In\",\n resetPassword: \"Reset Password\",\n createAccount: \"Create Account\",\n backToSignIn: \"Back to Sign In\",\n signInWithPhone: \"Sign in with Phone\",\n phoneNumber: \"Phone Number\",\n verificationCode: \"Verification Code\",\n sendCode: \"Send Code\",\n verifyCode: \"Verify Code\",\n signInWithGoogle: \"Sign in with Google\",\n signInWithFacebook: \"Sign in with Facebook\",\n signInWithApple: \"Sign in with Apple\",\n signInWithMicrosoft: \"Sign in with Microsoft\",\n signInWithGitHub: \"Sign in with GitHub\",\n signInWithTwitter: \"Sign in with Twitter\",\n signInWithEmailLink: \"Sign in with Email Link\",\n sendSignInLink: \"Send Sign-in Link\",\n termsOfService: \"Terms of Service\",\n privacyPolicy: \"Privacy Policy\",\n resendCode: \"Resend Code\",\n sending: \"Sending...\",\n multiFactorEnrollment: \"Multi-factor Enrollment\",\n mfaTotpVerification: \"TOTP Verification\",\n mfaSmsVerification: \"SMS Verification\",\n generateQrCode: \"Generate QR Code\",\n },\n prompts: {\n noAccount: \"Don't have an account?\",\n haveAccount: \"Already have an account?\",\n enterEmailToReset: \"Enter your email address to reset your password\",\n signInToAccount: \"Sign in to your account\",\n enterDetailsToCreate: \"Enter your details to create a new account\",\n enterPhoneNumber: \"Enter your phone number\",\n enterVerificationCode: \"Enter the verification code\",\n enterEmailForLink: \"Enter your email to receive a sign-in link\",\n mfaEnrollmentPrompt: \"Select a new multi-factor enrollment method\",\n },\n} satisfies Translations;\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { enUS } from \"./locales/en-us\";\nimport { type RegisteredLocale } from \".\";\nimport type { ErrorKey, TranslationCategory, TranslationKey, TranslationSet } from \"./types\";\n\nexport const ERROR_CODE_MAP = {\n \"auth/user-not-found\": \"userNotFound\",\n \"auth/wrong-password\": \"wrongPassword\",\n \"auth/invalid-email\": \"invalidEmail\",\n \"auth/user-disabled\": \"userDisabled\",\n \"auth/network-request-failed\": \"networkRequestFailed\",\n \"auth/too-many-requests\": \"tooManyRequests\",\n \"auth/email-already-in-use\": \"emailAlreadyInUse\",\n \"auth/weak-password\": \"weakPassword\",\n \"auth/operation-not-allowed\": \"operationNotAllowed\",\n \"auth/invalid-phone-number\": \"invalidPhoneNumber\",\n \"auth/missing-phone-number\": \"missingPhoneNumber\",\n \"auth/quota-exceeded\": \"quotaExceeded\",\n \"auth/code-expired\": \"codeExpired\",\n \"auth/captcha-check-failed\": \"captchaCheckFailed\",\n \"auth/missing-verification-id\": \"missingVerificationId\",\n \"auth/missing-email\": \"missingEmail\",\n \"auth/invalid-action-code\": \"invalidActionCode\",\n \"auth/credential-already-in-use\": \"credentialAlreadyInUse\",\n \"auth/requires-recent-login\": \"requiresRecentLogin\",\n \"auth/provider-already-linked\": \"providerAlreadyLinked\",\n \"auth/invalid-verification-code\": \"invalidVerificationCode\",\n \"auth/account-exists-with-different-credential\": \"accountExistsWithDifferentCredential\",\n \"auth/display-name-required\": \"displayNameRequired\",\n \"auth/second-factor-already-in-use\": \"secondFactorAlreadyInUse\",\n} satisfies Record<string, ErrorKey>;\n\nexport type ErrorCode = keyof typeof ERROR_CODE_MAP;\n\nexport function getTranslation<T extends TranslationCategory>(\n locale: RegisteredLocale,\n category: T,\n key: TranslationKey<T>\n): string {\n const userTranslationSet = locale.translations[category] as TranslationSet<T> | undefined;\n const translatedString = userTranslationSet?.[key];\n\n if (translatedString) {\n return translatedString;\n }\n\n // Check fallback locale if it exists\n if (locale.fallback) {\n const fallbackTranslation = getTranslation(locale.fallback, category, key);\n\n if (fallbackTranslation) {\n return fallbackTranslation;\n }\n }\n\n // Fall back to English translations\n const fallbackTranslationSet = enUS[category] as TranslationSet<T>;\n return fallbackTranslationSet[key];\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { enUS } from \"./locales/en-us\";\nimport { type Translations } from \"./types\";\n\nexport type * from \"./types\";\nexport * from \"./mapping\";\n\nexport type Locale = \"en-US\" | `${string}-${string}` | string;\n\nexport function registerLocale(\n locale: Locale,\n translations: Translations,\n fallback?: RegisteredLocale\n): RegisteredLocale {\n return {\n locale,\n translations,\n fallback,\n };\n}\n\nexport const enUs = registerLocale(\"en-US\", enUS);\n\nexport type RegisteredLocale = {\n locale: Locale;\n translations: Translations;\n fallback?: RegisteredLocale;\n};\n"]}
1
+ {"version":3,"sources":["../src/locales/en-us.ts","../src/mapping.ts","../src/index.ts"],"names":["enUS","ERROR_CODE_MAP","getTranslation","locale","category","key","replacements","translatedString","str","fallbackTranslation","match","p1","registerLocale","translations","fallback","enUs"],"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B,eAAA,CACvB,mBAAA,CAAqB,aAAA,CACrB,4BAA6B,oBAAA,CAC7B,8BAAA,CAAgC,uBAAA,CAChC,oBAAA,CAAsB,eACtB,0BAAA,CAA4B,mBAAA,CAC5B,gCAAA,CAAkC,wBAAA,CAClC,6BAA8B,qBAAA,CAC9B,8BAAA,CAAgC,uBAAA,CAChC,gCAAA,CAAkC,0BAClC,+CAAA,CAAiD,sCAAA,CACjD,4BAAA,CAA8B,qBAAA,CAC9B,oCAAqC,0BACvC,EAiBO,SAASC,CAAAA,CACdC,EACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACQ,CAER,IAAMC,CAAAA,CADqBJ,CAAAA,CAAO,YAAA,CAAaC,CAAQ,IACTC,CAAG,CAAA,CAE7CG,CAAAA,CAEJ,GAAID,EACFC,CAAAA,CAAMD,CAAAA,CAAAA,KAAAA,GACGJ,CAAAA,CAAO,QAAA,CAAU,CAC1B,IAAMM,CAAAA,CAAsBP,CAAAA,CAAeC,CAAAA,CAAO,SAAUC,CAAAA,CAAUC,CAAG,CAAA,CAErEI,CAAAA,GACFD,EAAMC,CAAAA,EAEV,CAAA,KAEED,CAAAA,CAD+BR,CAAAA,CAAKI,CAAQ,CAAA,CACfC,CAAG,CAAA,CAGlC,OAAIC,IACFE,CAAAA,CAAMA,CAAAA,EAAK,OAAA,CAAQ,UAAA,CAAY,CAACE,CAAAA,CAAOC,CAAAA,GAAOL,CAAAA,CAAaK,CAAE,GAAKD,CAAK,CAAA,CAAA,CAGlEF,CAAAA,EAAO,EAChB,CC9DO,SAASI,CAAAA,CACdT,CAAAA,CACAU,CAAAA,CACAC,EACkB,CAClB,OAAO,CACL,MAAA,CAAAX,EACA,YAAA,CAAAU,CAAAA,CACA,QAAA,CAAAC,CACF,CACF,CAGO,IAAMC,CAAAA,CAAOH,CAAAA,CAAe,QAASZ,CAAI","file":"index.js","sourcesContent":["/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type Translations } from \"../types\";\n\n/** English US (en-US) translation set with all default translations. */\nexport const enUS = {\n errors: {\n userNotFound: \"No account found with this email address\",\n wrongPassword: \"Incorrect password\",\n invalidEmail: \"Please enter a valid email address\",\n userDisabled: \"This account has been disabled\",\n networkRequestFailed: \"Unable to connect to the server. Please check your internet connection\",\n tooManyRequests: \"Too many failed attempts. Please try again later\",\n missingVerificationCode: \"Please enter the verification code\",\n emailAlreadyInUse: \"An account already exists with this email\",\n invalidCredential: \"The provided credentials are invalid.\",\n weakPassword: \"Password should be at least 8 characters\",\n unverifiedEmail: \"Please verify your email address to continue.\",\n operationNotAllowed: \"This operation is not allowed. Please contact support.\",\n invalidPhoneNumber: \"The phone number is invalid\",\n missingPhoneNumber: \"Please provide a phone number\",\n quotaExceeded: \"SMS quota exceeded. Please try again later\",\n codeExpired: \"The verification code has expired\",\n captchaCheckFailed: \"reCAPTCHA verification failed. Please try again.\",\n missingVerificationId: \"Please complete the reCAPTCHA verification first.\",\n missingEmail: \"Please provide an email address\",\n invalidActionCode: \"The password reset link is invalid or has expired\",\n credentialAlreadyInUse: \"An account already exists with this email. Please sign in with that account.\",\n requiresRecentLogin: \"This operation requires a recent login. Please sign in again.\",\n providerAlreadyLinked: \"This phone number is already linked to another account\",\n invalidVerificationCode: \"Invalid verification code. Please try again\",\n unknownError: \"An unexpected error occurred\",\n popupClosed: \"The sign-in popup was closed. Please try again.\",\n accountExistsWithDifferentCredential:\n \"An account already exists with this email. Please sign in with the original provider.\",\n displayNameRequired: \"Please provide a display name\",\n secondFactorAlreadyInUse: \"This phone number is already enrolled with this account.\",\n },\n messages: {\n passwordResetEmailSent: \"Password reset email sent successfully\",\n signInLinkSent: \"Sign-in link sent successfully\",\n verificationCodeFirst: \"Please request a verification code first\",\n checkEmailForReset: \"Check your email for password reset instructions\",\n dividerOr: \"or\",\n termsAndPrivacy: \"By continuing, you agree to our {tos} and {privacy}.\",\n mfaSmsAssertionPrompt: \"A verification code will be sent to {phoneNumber} to complete the authentication process.\",\n },\n labels: {\n emailAddress: \"Email Address\",\n password: \"Password\",\n displayName: \"Display Name\",\n forgotPassword: \"Forgot Password?\",\n signUp: \"Sign Up\",\n signIn: \"Sign In\",\n resetPassword: \"Reset Password\",\n createAccount: \"Create Account\",\n backToSignIn: \"Back to Sign In\",\n signInWithPhone: \"Sign in with Phone\",\n phoneNumber: \"Phone Number\",\n verificationCode: \"Verification Code\",\n sendCode: \"Send Code\",\n verifyCode: \"Verify Code\",\n signInWithGoogle: \"Sign in with Google\",\n signInWithFacebook: \"Sign in with Facebook\",\n signInWithApple: \"Sign in with Apple\",\n signInWithMicrosoft: \"Sign in with Microsoft\",\n signInWithGitHub: \"Sign in with GitHub\",\n signInWithTwitter: \"Sign in with X\",\n signInWithEmailLink: \"Sign in with Email Link\",\n sendSignInLink: \"Send Sign-in Link\",\n termsOfService: \"Terms of Service\",\n privacyPolicy: \"Privacy Policy\",\n resendCode: \"Resend Code\",\n sending: \"Sending...\",\n multiFactorEnrollment: \"Multi-factor Enrollment\",\n multiFactorAssertion: \"Multi-factor Authentication\",\n mfaTotpVerification: \"TOTP Verification\",\n mfaSmsVerification: \"SMS Verification\",\n generateQrCode: \"Generate QR Code\",\n },\n prompts: {\n noAccount: \"Don't have an account?\",\n haveAccount: \"Already have an account?\",\n enterEmailToReset: \"Enter your email address to reset your password\",\n signInToAccount: \"Sign in to your account\",\n smsVerificationPrompt: \"Enter the verification code sent to your phone number\",\n enterDetailsToCreate: \"Enter your details to create a new account\",\n enterPhoneNumber: \"Enter your phone number\",\n enterVerificationCode: \"Enter the verification code\",\n enterEmailForLink: \"Enter your email to receive a sign-in link\",\n mfaEnrollmentPrompt: \"Select a new multi-factor enrollment method\",\n mfaAssertionPrompt: \"Please complete the multi-factor authentication process\",\n mfaAssertionFactorPrompt: \"Please choose a multi-factor authentication method\",\n mfaTotpQrCodePrompt: \"Scan this QR code with your authenticator app\",\n mfaTotpEnrollmentVerificationPrompt: \"Add the code generated by your authenticator app\",\n },\n} satisfies Translations;\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { enUS } from \"./locales/en-us\";\nimport { type RegisteredLocale } from \".\";\nimport type { ErrorKey, TranslationCategory, TranslationKey, TranslationSet } from \"./types\";\n\n/** Maps Firebase authentication error codes to translation keys. */\nexport const ERROR_CODE_MAP = {\n \"auth/user-not-found\": \"userNotFound\",\n \"auth/wrong-password\": \"wrongPassword\",\n \"auth/invalid-email\": \"invalidEmail\",\n \"auth/unverified-email\": \"unverifiedEmail\",\n \"auth/user-disabled\": \"userDisabled\",\n \"auth/missing-code\": \"missingVerificationCode\",\n \"auth/invalid-credential\": \"invalidCredential\",\n \"auth/network-request-failed\": \"networkRequestFailed\",\n \"auth/too-many-requests\": \"tooManyRequests\",\n \"auth/email-already-in-use\": \"emailAlreadyInUse\",\n \"auth/weak-password\": \"weakPassword\",\n \"auth/operation-not-allowed\": \"operationNotAllowed\",\n \"auth/invalid-phone-number\": \"invalidPhoneNumber\",\n \"auth/missing-phone-number\": \"missingPhoneNumber\",\n \"auth/quota-exceeded\": \"quotaExceeded\",\n \"auth/code-expired\": \"codeExpired\",\n \"auth/captcha-check-failed\": \"captchaCheckFailed\",\n \"auth/missing-verification-id\": \"missingVerificationId\",\n \"auth/missing-email\": \"missingEmail\",\n \"auth/invalid-action-code\": \"invalidActionCode\",\n \"auth/credential-already-in-use\": \"credentialAlreadyInUse\",\n \"auth/requires-recent-login\": \"requiresRecentLogin\",\n \"auth/provider-already-linked\": \"providerAlreadyLinked\",\n \"auth/invalid-verification-code\": \"invalidVerificationCode\",\n \"auth/account-exists-with-different-credential\": \"accountExistsWithDifferentCredential\",\n \"auth/display-name-required\": \"displayNameRequired\",\n \"auth/second-factor-already-in-use\": \"secondFactorAlreadyInUse\",\n} satisfies Record<string, ErrorKey>;\n\n/** Firebase authentication error code type. */\nexport type ErrorCode = keyof typeof ERROR_CODE_MAP;\n\n/**\n * Retrieves a translation string for a given locale, category, and key.\n *\n * Falls back to the locale's fallback locale or English US if the translation is not found.\n * Supports string replacements using {placeholder} syntax.\n *\n * @param locale - The registered locale to get the translation from.\n * @param category - The translation category (e.g., \"errors\", \"labels\").\n * @param key - The translation key within the category.\n * @param replacements - Optional object with replacement values for placeholders in the translation string.\n * @returns The translated string, or an empty string if not found.\n */\nexport function getTranslation<T extends TranslationCategory>(\n locale: RegisteredLocale,\n category: T,\n key: TranslationKey<T>,\n replacements?: Record<string, string>\n): string {\n const userTranslationSet = locale.translations[category] as TranslationSet<T> | undefined;\n const translatedString = userTranslationSet?.[key];\n\n let str: string | undefined;\n\n if (translatedString) {\n str = translatedString;\n } else if (locale.fallback) {\n const fallbackTranslation = getTranslation(locale.fallback, category, key);\n\n if (fallbackTranslation) {\n str = fallbackTranslation;\n }\n } else {\n const fallbackTranslationSet = enUS[category] as TranslationSet<T>;\n str = fallbackTranslationSet[key];\n }\n\n if (replacements) {\n str = str?.replace(/{(\\w+)}/g, (match, p1) => replacements[p1] || match);\n }\n\n return str || \"\";\n}\n","/**\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { enUS } from \"./locales/en-us\";\nimport { type Translations } from \"./types\";\n\nexport type * from \"./types\";\nexport * from \"./mapping\";\n\n/** Locale identifier string. Supports BCP 47 format (e.g., \"en-US\") or any string. */\nexport type Locale = \"en-US\" | `${string}-${string}` | string;\n\n/**\n * Registers a locale with its translations and optional fallback locale.\n *\n * @param locale - The locale identifier (e.g., \"en-US\", \"fr-FR\").\n * @param translations - The translation object for this locale.\n * @param fallback - Optional fallback locale to use when a translation is missing.\n * @returns A registered locale object.\n */\nexport function registerLocale(\n locale: Locale,\n translations: Translations,\n fallback?: RegisteredLocale\n): RegisteredLocale {\n return {\n locale,\n translations,\n fallback,\n };\n}\n\n/** Pre-registered English US locale with default translations. */\nexport const enUs = registerLocale(\"en-US\", enUS);\n\n/** A registered locale with its translations and optional fallback. */\nexport type RegisteredLocale = {\n /** The locale identifier. */\n locale: Locale;\n /** The translation object for this locale. */\n translations: Translations;\n /** Optional fallback locale to use when a translation is missing. */\n fallback?: RegisteredLocale;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase-oss/ui-translations",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Translations for Firebase UI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -16,8 +16,13 @@
16
16
  "files": [
17
17
  "dist"
18
18
  ],
19
+ "devDependencies": {
20
+ "rimraf": "^6.0.1",
21
+ "vitest": "^3.2.4",
22
+ "tsup": "8.5.0",
23
+ "typescript": "^5.9.2"
24
+ },
19
25
  "scripts": {
20
- "prepare": "tsup",
21
26
  "build": "tsup",
22
27
  "build:local": "pnpm run build && pnpm pack",
23
28
  "dev": "tsup --watch",
@@ -26,13 +31,9 @@
26
31
  "clean": "rimraf dist",
27
32
  "test": "vitest run",
28
33
  "test:watch": "vitest",
34
+ "version:bump": "pnpm version patch",
29
35
  "publish:tags": "sh -c 'TAG=\"${npm_package_name}@${npm_package_version}\"; git tag --list \"$TAG\" | grep . || git tag \"$TAG\"; git push origin \"$TAG\"'",
36
+ "publish:npm": "pnpm publish --access public --tag beta",
30
37
  "release": "npm run build && pnpm pack --pack-destination ../../releases/"
31
- },
32
- "devDependencies": {
33
- "rimraf": "catalog:",
34
- "vitest": "catalog:",
35
- "tsup": "catalog:",
36
- "typescript": "catalog:"
37
38
  }
38
- }
39
+ }