You can translate the field labels, headers, and other UI elements of the Industries Cart using a custom language file.
To translate the cart UI:
-
Enable a translation file:
-
Go to Setup.
-
In the Quick Find box, type Translation Workbench.
-
From the search results, click Translation Settings.
-
Click Enable, if it is not already selected.
-
-
Add a new (supported) language. See Vlocity Locale Codes.
-
On the Translation Settings page, click Add.
-
From the Language drop-down list, select the language you wish to add, for example, English.
-
To assign a user as a translator for the selected language, select the user in the Available List , and add the user to the Selected List.
-
Ensure that the Active field is checked.
-
Click Save.
-
-
Export the language file:
-
Go to Setup.
-
In the Quick Find box, type Translation Workbench.
-
From the search results, click Export.
-
Select Untranslated and click Export as STF.
You will be notified by an email when the export is complete.
-
Follow the link in the email.
-
In the Recent Documents section, click the document named
Untranslated_timestamp.zip. -
Click View file to download the file.
-
Unzip the
.zipfile.
-
-
Create translations:
You can create translations by entering a command or by using a Python script.
-
In your terminal, navigate to the folder containing the downloaded
.stffile.Use sed $'s/\t/&**/g' source.stf > output.stf command.
This command appends ** before each string value.
Example: sed $'s/\t/&**/g' Untranslated_iw_2018-03-09\ 0112.stf > Translated.stf
Open the
Translated.stffile and verify that there are ** before each label.NoteBefore importing the
Translated.stffile, open the file and shorten the field labels if they are longer than 40 characters, for example, 'OverriddenAttributeAssignmentCategoryId', 'OverriddenOfferPricingComponentId'. Remove some characters from the label names, if not the import will fail due to 40 characters limitation. If the labels are already 40 characters long, adding ** will make their length to be 42 characters causing the import to fail. -
Alternatively, you can use the following Python script to create translations:
------------------------------------------ import sys # Take two files as input (the last one might not exist if it does exist the content is appended. #The first file represents the input file with un-translated strings. #The second one represents the output file where the translations will be written. ## #The translation process consists of taking strings of the form: # ButtonOrLink.vlocity_cmt__Application__c.vlocity_cmt__Review Review #and converting them to: # ButtonOrLink.vlocity_cmt__Application__c.vlocity_cmt__Review **Review # # by adding "**" after the tab. # #In the case that after the translation a string is longer than 40 characters (and its key contains '.FieldLabel') # then the last characters are removed. def main(): input = sys.argv[1] output = sys.argv[2] with open(input, 'r') as input_file: for line in input_file: line = line.strip() if '\t' in line: line = line.replace("\t", "\t**") line = removeExtraCharacters(line) with open(output, 'a') as output_file: output_file.write(line + '\n') def removeExtraCharacters(input): if '.FieldLabel' not in input: return input keyValuePair = input.split('\t') key = keyValuePair[0] value = keyValuePair[1] length = len(value) if length <= 40: return input else: value = value[:40] output = key + '\t' + value return output if __name__ == '__main__': main() ------------------------------------------------
-
-
Import the translated file:
-
In the Quick Find box, type Translation Workbench.
-
From the search results, click Import.
-
Click Choose File.
-
Select the file you edited for translations.
-
Click Import.
-
-
Change the language in your org:
-
In the Search Setup box, type in your user account name.
-
Click Edit.
-
Scroll to the Locale Settings section and set the Locale and Language settings.
-
Click Save.
Now, most labels on your org render in the selected language. However, note that you cannot translate Tabs, Objects, and Record names. The label for the 'name' field in every Salesforce object must be translated manually as Salesforce needs grammatical information.
-
-
To translate labels manually:
-
Go to the Quick Find box and type Rename Tab and Labels.
-
Select Rename Tabs and Labels from the search results.
-
From the Select Language drop-down list, select the language you want to rename the labels into. The labels are translated and are displayed in the Display label column.
-
- Vlocity Locale Codes
This table lists the Vlocity locale codes that you can activate for translating label names. This is an out-of-the-box list that Salesforce provides. You can activate only three locale values at a time. See Activating Vlocity Locale Code Values