Skip to content
smehta-veeva edited this page Jun 18, 2020 · 3 revisions

Introduction

The vsdk-translation-service-sample project demonstrates the usage of the Vault SDK translation service. The translation service is used to retrieve translated messages. These translated messages can be added via MDL or using the Message Catalog in the Admin UI in Vault.

This project will demonstrate the usage of the Vault translation service in an SDK trigger. The Trigger will accomplish the following:

  • Validate that the product exists and show a translated error in French if it does not.
  • Validate that the order quantity is less than the quantity in stock and show a translated error in French if it does not.
  • Validate that the product is in stock (quantity is greater than 0) and show a translated error if it does not.

Setup

The project contains two separate vault packages (VPK) in the deploy-vpk directory with the necessary Objects, Triggers and Messages required for this project.

  1. Clone or download the sample Maven project vSDK Translation Service Sample project from Github.

  2. Run through the Getting Started guide to setup your development environment.

  3. Log in to your vault and navigate to Admin > Deployment > Inbound Packages and click Import:

  4. Locate and select the following file in your downloaded project file:

    Deploy vault components: Select the \deploy-vpk\components\vsdk-translation-service-sample-components.vpk file.

  5. From the Actions menu (gear icon), select Review & Deploy. Vault displays a list of all components in the package. You can safely ignore any warnings that may appear.

InboundPackage
  1. Review the prompts to deploy the package. You will receive an email when vault completes the deployment.

  2. Repeat steps 3-6 for the vault code:

    Custom Trigger code: \deploy-vpk\code\vsdk-translation-service-sample-code.vpk file.

  3. Export the French Translation Field Label Translations file Bulk Translation Import tool.This tool can be found in the Vault UI Admin Screen at Admin > Settings > Language & Region Settings > Bulk Translation.

Bulk Translation Tool

Select French as the Export Translation File language. The same process(step 8-11) can be used for any other language that needs to have updated translations.

Export translations
  1. Open the exported file and locate the validation messages.
Validation Messages
  1. Add the translations in column F of the CSV and save as a txt file. Note, this step must be done for any other language that you want to update the translations for.
Updated Translations
  1. Import the translations in to Vault using the Bulk translations tool:
Import Translations

Once the packages have been deployed, you will want to review the configuration and understand the normal behaviour so you can observe the effects of the sample code. Any warnings in the deployment logs can be ignored.

Additional Optional Setup

To change other field labels, you can follow the same procedure as Steps 8-11 of the Setup steps. In this example, the labels for the Bicycle Order page layout will be changed to French.

  1. Select French as the Export Translation File language.
Export translations
  1. Open the exported file and locate the labels that you would like to change and add the translations in column F of the CSV and save as a Txt or Tab separated CSV file. Note, this step must be done for any other language and any other field labels that you want to update the translations for.
Extra Translations
  1. Import the translations in to Vault using the Bulk translations tool:
Import Translations
  1. When the user language is changed to French via the user profile(Username dropdown -> User Profile):
Change Language

The Create Bicycle Order Page at Admin -> Administrateur Fonctionnel -> Commandes de vélos will appear as such:

Bicycle Order Page Layout

Objects

  • Bicycle Order (bicycle_order__c)
  • Bicycle Manufacturer (bicycle_manufacturer__c)
  • Bicycle Model (bicycle_model__c)

Run the project

Now the code has been deployed you can see the project in action, by following the steps below in vault:

Note: Should you wish to step through the code in action you can also configure the debugger and set breakpoints.

Navigate to your user profile(Username dropdown -> User Profile), edit and change the language to French and press Save.

Change Language

Once the language has been changed to French, navigate to Admin -> Administrateur Fonctionnel -> Bicycle Order and create a new record by pressing the + Créer button. If you completed the additional optional setup, you will need to navigate to Admin -> Administrateur Fonctionnel -> Commandes de vélos

  • To view the Order Quantity exceeds Stock translated error message(in French), enter the values as shown in the image and save by pressing the Enregistrer button. Note, labels may differ depending on which language you selected and if you completed the additional optional steps.

The same error message in English will display with the following text:

  • To view the Product Out of stock translated error message, enter the following values and save by pressing the Enregistrer button:

The same error message in English will display with the following text:

  • To view the Product does not exist translated error message, enter the following values and save by pressing the Enregistrer button:

The same error message in English will display with the following text:

Language Reset

To reset the user's language back to English from French, the following steps must be followed:

  1. From the User name drop down at the top right corner of the page, select Profil utilisateur:
  1. Press the Modifier button with the pencil icon:
  1. Scroll down to the Paramètres area, select Anglais(English) option from the Langue dropdown and press the Confirmer button to confirm:
  1. Press the Enregistrer button to save: