Skip to content

Commit 20c2e29

Browse files
authored
feat(backend): Add support for User locale (#6938)
1 parent 43a9c2b commit 20c2e29

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

.changeset/calm-brooms-grab.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/backend': minor
3+
---
4+
5+
Added support for User `locale`

packages/backend/src/api/endpoints/UserApi.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ type CreateUserParams = {
8181
password?: string;
8282
firstName?: string;
8383
lastName?: string;
84+
/** The locale of the user in BCP-47 format. */
85+
locale?: string;
8486
skipPasswordChecks?: boolean;
8587
skipPasswordRequirement?: boolean;
8688
skipLegalChecks?: boolean;
@@ -149,6 +151,9 @@ type UpdateUserParams = {
149151
/** A custom timestamp denoting when the user accepted legal requirements, specified in RFC3339 format (e.g. 2012-10-20T07:15:20.902Z). */
150152
legalAcceptedAt?: Date;
151153

154+
/** The locale of the user in BCP-47 format. */
155+
locale?: string;
156+
152157
/** If true, the user can delete themselves with the Frontend API. */
153158
deleteSelfEnabled?: boolean;
154159

packages/backend/src/api/resources/JSON.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,10 @@ export interface UserJSON extends ClerkResourceJSON {
606606
create_organizations_limit: number | null;
607607
delete_self_enabled: boolean;
608608
legal_accepted_at: number | null;
609+
/**
610+
* The locale of the user in BCP-47 format.
611+
*/
612+
locale: string | null;
609613
}
610614

611615
export interface VerificationJSON extends ClerkResourceJSON {

packages/backend/src/api/resources/User.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ export class User {
144144
* The unix timestamp of when the user accepted the legal requirements. `null` if [**Require express consent to legal documents**](https://clerk.com/docs/guides/secure/legal-compliance) is not enabled.
145145
*/
146146
readonly legalAcceptedAt: number | null,
147+
148+
/**
149+
* The locale of the user in BCP-47 format.
150+
*/
151+
readonly locale: string | null,
147152
) {}
148153

149154
static fromJSON(data: UserJSON): User {
@@ -180,6 +185,7 @@ export class User {
180185
data.create_organizations_limit,
181186
data.delete_self_enabled,
182187
data.legal_accepted_at,
188+
data.locale,
183189
);
184190
res._raw = data;
185191
return res;

0 commit comments

Comments
 (0)