Common API Tasks🐈: Change the language of your DocuSign web app

Common API Tasks: Change the language of your DocuSign web app

Welcome to an awesome new edition of the CAT🐈 (Common API Tasks) blog series. The CAT blogs provide all you need to complete small, specific, SDK-supported tasks using one of our APIs. You can find all articles in this series on the DocuSign Developer Blog. 

Did you know that the DocuSign signing experience can be localized in 44 different languages? And that the DocuSign web app supports 14 different languages? DocuSign is a global company and we support signers in almost every country. The web app can currently work in 14 languages and more will be coming in the future. You can use the eSignature REST API to set the appropriate language both for signers as well as web app users. In this blog post I’m going to show you how to do the latter. 

The code snippets below are very simple. The language selection is applied to a specific user. As an administrator you can control other users’ language, and if you run this in a context of a specific user, then you can always update that user’s language.

The method to update the user settings is used with the parameter called locale. A locale is a short form designation of the chosen language (note that it is case sensitive). Here is the list of 14 languages supported by the DocuSign web app and each of their locals:

Language Locale
English en
German de
Spanish es
French fr
Italian it
Dutch nl
Polish pl
Brazilian Portuguese pt_BR
Portuguese pt
Russian ru
Traditional Chinese zh_TW
Simplified Chinese zh_CN
Japanese ja
Korean ko

So, to summarize, you need three pieces of information:

  1. accountId: that is needed for almost any API call.
  2. userId: you can find it on the Apps and Keys page.
  3. locale: the desired languages from the table above.

Once you have these, the code snippets are pretty straightforward. Here they are:

C#

var apiClient = new ApiClient(basePath);
// You will need to obtain an access token using your chosen authentication method
apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
var usersApi = new UsersApi(apiClient);
var userSettingsInformation = new UserSettingsInformation { Locale = "es" };
// Make sure to find the values for accountId and userId
usersApi.UpdateSettings(accountId, userId, userSettingsInformation);

Java

// You will need to obtain an access token using your chosen authentication flow 
Configuration config = new Configuration(new ApiClient(basePath));
config.addDefaultHeader("Authorization", "Bearer " + accessToken);
UsersApi usersApi = new UsersApi(config);
UserSettingsInformation userSettingsInformation = new UserSettingsInformation();
userSettingsInformation.setLocale("es");
// Make sure to find the values for accountId and userId
usersApi.UpdateSettings(accountId, userId, userSettingsInformation);

Node.js

// You will need to obtain an access token using your chosen authentication flow 
let dsApiClient = new docusign.ApiClient();
dsApiClient.setBasePath(basePath);
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + accessToken);
let usersApi = new docusign.UsersApi(apiClient);
let userSettingsInformation = new docusign.UserSettingsInformation();
userSettingsInformation.locale = 'es';
// Make sure to find the values for accountId and userId
usersApi.updateSettings(accountId, userId, userSettingsInformation);

PHP

# You will need to obtain an access token using your chosen authentication flow 
$api_client = new \DocuSign\eSign\client\ApiClient($base_path);
$config = new \DocuSign\eSign\Model\Configuration($api_client);
$config->addDefaultHeader('Authorization', 'Bearer ' + $access_token);
$users_api = new \DocuSign\eSign\Api\UsersApi($api_client);
$user_settings_information = new \DocuSign\eSign\Model\UserSettingsInformation();
$user_settings_information->setLocale('es');
# Make sure to find the values for $account_id and $user_id
$users_api->updateSettings($account_id, $user_id, $user_settings_information);

Python

# You will need to obtain an access token using your chosen authentication flow 
api_client = ApiClient()
api_client.set_default_header('Authorization', 'Bearer ' + access_token)
users_api = UsersApi(api_client)
user_settings_information = UserSettingsInformation()
user_settings_information.locale = 'es'
# Make sure to find the values for account_id and user_id
users_api.update_settings(account_id, user_id, user_settings_information)

Ruby

# You will need to obtain an access token using your chosen authentication flow 
config = DocuSign_eSign::Configuration.new
config.host = base_path
api_client = DocuSign_eSign::ApiClient.new config
api_client.DefaultHeader['Authorization'] = 'Bearer ' + access_token
users_api = DocuSign_eSign::UsersApi.new api_client
user_settings_information = DocuSign_eSign::UserSettingsInformation.new
user_settings_information.locale = 'es'
# Make sure to find the values for account_id and user_id
users_api.update_settings(account_id, user_id, user_settings_information)

And that’s a wrap! I hope you found it useful. If you have any questions, comments, or suggestions for topics for future Common API Tasks posts, feel free to email me. Until next time...

Additional resources

Inbar Gazit
Author
Inbar Gazit
Sr. Manager, Developer Content
Published