Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .changeset/thirty-breads-strive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'@clerk/localizations': patch
'@clerk/shared': patch
---

A utility function that converts flattened localization objects (with dot-notation keys) to nested `LocalizationResource` objects for use with Clerk's `localization` prop.

```typescript
import { ClerkProvider } from '@clerk/nextjs';
import { flatLocalization } from '@clerk/localizations/utils';

const localization = flatLocalization({
'formFieldLabel__emailAddress': 'Email address',
'unstable__errors.passwordComplexity.maximumLength': 'Password is too long',
});

export default function App() {
return (
<ClerkProvider localization={localization}>
{/* Your app */}
</ClerkProvider>
);
}
```
18 changes: 16 additions & 2 deletions packages/localizations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
"default": "./dist/index.js"
}
},
"./utils": {
"import": {
"types": "./dist/utils/index.d.mts",
"default": "./dist/utils/index.mjs"
},
"require": {
"types": "./dist/utils/index.d.ts",
"default": "./dist/utils/index.js"
}
},
"./*": {
"import": {
"types": "./dist/*.d.mts",
Expand All @@ -61,12 +71,16 @@
"format:check": "node ../../scripts/format-package.mjs --check",
"generate": "tsc src/utils/generate.ts && node src/utils/generate.js && prettier --write src/*.ts",
"lint": "eslint src",
"lint:attw": "attw --pack . --profile node16"
"lint:attw": "attw --pack . --profile node16",
"test": "vitest --run"
},
"dependencies": {
"@clerk/shared": "workspace:^"
},
"devDependencies": {},
"devDependencies": {
"@vitest/ui": "3.2.4",
"vitest": "3.2.4"
},
"engines": {
"node": ">=20.9.0"
},
Expand Down
Loading
Loading