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.
Languages
Clerk currently supports the following languages with English as the default:
English name | Language tag (BCP 47) | Key |
---|---|---|
Arabic (Saudi) | ar-SA | arSA |
Belarus | be-BY | beBY |
Bulgarian | bg-BG | bgBG |
Catalan | ca-ES | caES |
Czech | cs-CZ | csCZ |
Danish | da-DK | daDK |
German | de-DE | deDE |
Greek | el-GR | elGR |
English (US) | en-US | enUS |
Spanish | es-ES | esES |
Spanish (Mexico) | es-MX | esMX |
Finnish | fi-FI | fiFI |
French | fr-FR | frFR |
Hebrew | he-IL | heIL |
Croatian | hr-HR | hrHR |
Hungarian | hu-HU | huHU |
Icelandic | is-IS | isIS |
Italian | it-IT | itIT |
Japanese | ja-JP | jaJP |
Korean | ko-KR | koKR |
Mongolian | mn-MN | mnMN |
Norwegian | nb-NO | nbNO |
Dutch | nl-BE | nlBE |
Dutch | nl-NL | nlNL |
Polish | pl-PL | plPL |
Portuguese (BR) | pt-BR | ptBR |
Portuguese (PT) | pt-PT | ptPT |
Romanian | ro-RO | roRO |
Russian | ru-RU | ruRU |
Slovak | sk-SK | skSK |
Swedish | sv-SE | svSE |
Thai | th-TH | thTH |
Turkish | tr-TR | trTR |
Ukrainian | uk-UA | ukUA |
Vietnamese | vi-VN | viVN |
Chinese (Simplified) | zh-CN | zhCN |
Chinese (Traditional) | zh-TW | zhTW |
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 the following example, the fr-FR locale is imported as frFR
. The imported localization is then passed to the localization
prop on the <ClerkProvider>
.
In the following example, the fr-FR locale is imported as frFR
. The imported localization is then passed to the localization
prop in the ClerkApp
options.
In the following example, the fr-FR locale is imported as frFR
. The imported localization is then passed to the localization
prop on the clerk.load()
method.
Use the following tabs to view the code necessary for each file.
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