The SDK allows you to customize almost all of the text it displays, as well as add extra translations. You do so using the “locale” prop on the DynamicContextProvider.

In this short guide we will update some text in the default language (English), add an Italian translation, learn how to let the user change their language and along the way, learn all about the locale object you’ll be working with!

Let’s imagine we want to change the “Select your wallet” text in the image below to “Find your favorite” and then do the same with an Italian translation.

We simply need to inspect that element in the browser, and find the key that is being used to display that text by checking the copykey attribute on that element. In this case, you’ll see that it is “dyn_login.title.all_wallet_list”.

Now we’ll create our locale object, and add a new key with that value. It always starts with a key of the language you’re editing, in this case “en” for English. Then we add the key that we found in the browser, and then the value we want to replace it with.

const locale = {
  en: {
    dyn_login: {
      title: {
        all_wallet_list: "Find your favorite",
      },
    },
  },
  it: {
    dyn_login: {
      title: {
        all_wallet_list: "Trova il tuo preferito",
      },
    },
  },
};

We’re now ready to pass our locale object to the DynamicContextProvider like so:

<DynamicContextProvider settings={settings_go_here} locale={locale}>
  <App />
</DynamicContextProvider>

The result should then immediately show up in the SDK UI like so:

Next we’ll need to let the user change between languages, and it’s as simple as the following:

const {locale} = useDynamicContext();

 const handleOnClick = (localeProvided) => {
    if (localeProvided === 'it') {
      locale.changeLanguage('it');
    } else {
      locale.changeLanguage('en');
    }
 };

return (
  <button onClick={() => handleOnClick(locale.language)}>
    {locale.language === 'it' ? 'English' : 'Italiano'}
  </button>
);

That’s it! You now know how to customize the text in the SDK to your heart’s content.

Further Reading

Make sure to check out the full reference for the locale object here.