Localization prop (experimental)
Clerk offers the ability to override the strings for all of the elements in each of the Clerk Components. This allows you to provide localization for your users or change the wording to suit your brand.
@clerk/localizations
The @clerk/localizations
package contains predefined localizations for the Clerk Components. Clerk currently supports:
- ar-SA
- cs-CZ
- da-DK
- de-DE
- el-GR
- en-US (default)
- es-ES
- fr-FR
- he-IL
- it-IT
- ja-JP
- ko-KR
- nb-NO
- nl-NL
- pl-PL
- pt-BR
- pt-PT
- ru-RU
- sk-SK
- sv-SE
- tr-TR
- uk-UA
- vi-VN
- zh-CN
- zh-TW
Usage
To get started, install the @clerk/localizations
package.
Once the @clerk/localizations
package is installed, you can import the localizations you need by removing the "-" from the locale. In this example, the fr-FR locale is imported as frFR
. The imported localization is then passed to the localization
prop on the <ClerkProvider>
.
Adding or updating a localization
Our localizations are customer-sourced and we encourage customers to add or update localizations. To do so, follow these steps:
- Fork the https://github.com/clerk/javascript/ repo.
- Clone it locally to edit it.
- Review our Contributing guide.
- If you are updating an existing localization locate the file in
packages/localizations/src
- If you are adding a new language, copy the
en-US.ts
file and name it according to your language. The naming is the abbreviated language-region. For example, for French in Canada, it would befr-CA.ts.
- Go through the file and edit the entries.
- If you are adding a new localization, add the language to the
packages/localizations/src/index.ts
file. - Commit your changes to git and push them to your fork. Create a Pull Request from your fork to Clerk's repo against the
main
branch. We will review and either approve or ask for updates.
Custom localizations
You can also provide your own localizations for the Clerk Components. This is useful if you want to provide limited or quick localization for a language that Clerk doesn't currently support or if you want to change the wording to suit your brand.
Usage
To find the key for your translation (like the socialButtonsBlockButton
from the code example below), open up our English localization file. Search the file for the term that you want to customize.
For example, if you want to change the 'to continue to' string from the <SignIn />
and <SignUp />
components, you would search for 'to continue to'. You will find several instances of this. Some of those are in the the following signUp
object:
If you want to customize multiple entries from the <SignUp />
component, the procedure would resemble the following:
Feedback
Last updated on