@@ -46,6 +46,7 @@ import {
4646 generateSignatureWithMetamask ,
4747 generateSignatureWithOKXWallet ,
4848 getBaseIdentifier ,
49+ getBrowserLocale ,
4950 getClerkQueryParam ,
5051 getCoinbaseWalletIdentifier ,
5152 getMetamaskIdentifier ,
@@ -95,6 +96,7 @@ export class SignUp extends BaseResource implements SignUpResource {
9596 createdUserId : string | null = null ;
9697 abandonAt : number | null = null ;
9798 legalAcceptedAt : number | null = null ;
99+ locale : string | null = null ;
98100
99101 /**
100102 * The current status of the sign-up process.
@@ -154,6 +156,14 @@ export class SignUp extends BaseResource implements SignUpResource {
154156
155157 let finalParams = { ...params } ;
156158
159+ // Inject browser locale if not already provided
160+ if ( ! finalParams . locale ) {
161+ const browserLocale = getBrowserLocale ( ) ;
162+ if ( browserLocale ) {
163+ finalParams . locale = browserLocale ;
164+ }
165+ }
166+
157167 if ( ! __BUILD_DISABLE_RHC__ && ! this . clientBypass ( ) && ! this . shouldBypassCaptchaForAttempt ( params ) ) {
158168 const captchaChallenge = new CaptchaChallenge ( SignUp . clerk ) ;
159169 const captchaParams = await captchaChallenge . managedOrInvisible ( { action : 'signup' } ) ;
@@ -477,6 +487,7 @@ export class SignUp extends BaseResource implements SignUpResource {
477487 this . abandonAt = data . abandon_at ;
478488 this . web3wallet = data . web3_wallet ;
479489 this . legalAcceptedAt = data . legal_accepted_at ;
490+ this . locale = data . locale ;
480491 }
481492
482493 eventBus . emit ( 'resource:update' , { resource : this } ) ;
@@ -505,6 +516,7 @@ export class SignUp extends BaseResource implements SignUpResource {
505516 abandon_at : this . abandonAt ,
506517 web3_wallet : this . web3wallet ,
507518 legal_accepted_at : this . legalAcceptedAt ,
519+ locale : this . locale ,
508520 external_account : this . externalAccount ,
509521 external_account_strategy : this . externalAccount ?. strategy ,
510522 } ;
@@ -620,6 +632,10 @@ class SignUpFuture implements SignUpFutureResource {
620632 return this . resource . legalAcceptedAt ;
621633 }
622634
635+ get locale ( ) {
636+ return this . resource . locale ;
637+ }
638+
623639 get unverifiedFields ( ) {
624640 return this . resource . unverifiedFields ;
625641 }
@@ -670,6 +686,7 @@ class SignUpFuture implements SignUpFutureResource {
670686 captchaError,
671687 ...params ,
672688 unsafeMetadata : params . unsafeMetadata ? normalizeUnsafeMetadata ( params . unsafeMetadata ) : undefined ,
689+ locale : params . locale ?? getBrowserLocale ( ) ,
673690 } ;
674691
675692 await this . resource . __internal_basePost ( { path : this . resource . pathRoot , body } ) ;
0 commit comments