Download PDF
Download page Setting Up Multi-Language.
Setting Up Multi-Language
You can set up multi-language support for your site. Translation can be set up for the following:
- Static Labels or text (Page Titles, Header, Footer, Tabs, Descriptions) translations
- Field Label translations
Static Labels or text (Page Titles, Header, Footer, Tabs, Descriptions)
For static labels and text, you have the following two options for translation. You must update the translationModule parameter in the environment.ts file while configuring templates. For more information, see Configuring Templates.
- Use the local translation file
- Add translation details on the Conga Platform
Perform the following steps to add the translation details:
Step 1: Set the user-level locale
For translation, the application uses the user-level locale. You can set the user's locale using the following API: PATCH https://<URL_of_the_Instance>/api/user-management/v1/users/{userId}.
To get a list of supported locales, use the following API:
GET https://<URL_of_the_Instance>/api/user-management/v1/locales
Step 2: Add local translation file(s)
The application first checks the local translation files (JSON files used to define translations) in this folder: https://github.com/congarevenuecloud/partner-commerce/tree/release/february-23/src/assets/i18n
and then translates accordingly. The base template comes with some sample translation files under the assets/i18n
folder for your reference. You can clone any of the sample files and modify them to accommodate your preferred language.
Refer to the table below for the translation sequence.
Step 3: Add translation details on the Conga Platform
- Add a translation module using the Admin User Interface or the following API: POST
https://<URL_of_the_Instance>/api/localization/v1/translations/modules
- Update the
environment.ts
>translationModule
parameter with the module name added in the first step. Add a translation value for the given locale and module using the Admin User Interface or the following API: POST
https://<URL_of_the_Instance>/api/localization/v1/translations/{locale}/{module}.
You must use the CustomLabels in the parameter as a Key and the stringified value of your translation JSON file as a Value.
For example:
{ "Key": "CustomLabels" "Value": "<stringified value>" }
CODE
Refer to the following table to understand the sequence of translation impacts based on the previous steps:
File on Local Translation Folder | Translation details on the Conga Platform | Description |
---|---|---|
Available | Not Available | The application checks the user's locale and translates static labels or text based on the local translation file. Refer to the second above. |
Not Available | Available | The application checks the user's locale and translates static labels or text based on the translations added to the Conga Platform. Refer to the third step above. |
Available | Available | The application always merges with unique values, checks the user's locale, and appropriately translates static labels or text. |
Not Available | Not Available | The application considers English as a default language. |
Field Label
Define field label translation for the given object using the following API: POST https://<URL_of_the_Instance>/api/schema/v1/objects/{objectName}/translations/{locale}.
You can also use other CRUD operations for Field Label translation using Object Definition Translation APIs.
Example 1:
To translate the field label Phone Number available on the Account object into the Spanish (es_ES) language:
- Use the POST
https://<URL_of_the_Instance>/api/schema/v1/objects/{objectName}/translations/{locale}
API. - Enter Account in the objectName parameter.
Enter es_ES in the locale parameter.
To get a list of supported locales, use the following API:
GET
https://<URL_of_the_Instance>/api/user-management/v1/locales
Use the following sample request body.
{ "ObjectName": "Account", "MetadataTranslations": [ { "Scope": "Field", "Name": "Phone Number", "DisplayName": "Nombre de usuario", "Description": "English to Spanish translation for Phone Number field." } ] }
CODE
Example 2:
To translate the field label Email and Shipping Address available on the Account object into the Italian (Switzerland) (it_CH) language:
- Use the POST
https://<URL_of_the_Instance>/api/schema/v1/objects/{objectName}/translations/{locale}
API. - Enter Account in the objectName parameter.
Enter it_CH in the locale parameter.
To get a list of supported locales, use the following API:
GET
https://<URL_of_the_Instance>/api/user-management/v1/locales
Use the following sample request body.
{ "ObjectName": "Account", "MetadataTranslations": [ { "Scope": "Field", "Name": "Email", "DisplayName": "la posta elettronica", "Description": "English to Spanish translation for Email field." }, { "Scope": "Field", "Name": "Shipping Address", "DisplayName": "Indirizzo di spedizione", "Description": "English to Spanish translation for Shipping Address field." } ] }
CODE