- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Need to translate an SLA Definition? Check this!
Localization Framework supports many artifacts out of the box, but sometimes you may need to translate content from a table that isn't supported by default.
In this article, we'll create a custom artifact for the contract_sla table so that SLA Definitions can be translated using the standard Localization Framework workflow.
The Artifact
Just in case you aren't familiar with what this is, or how to do that, check out the following posts:
Step 1 - Create the Artifact Configuration
Navigate to:
Localization Framework > Artifact Configurations
Create a new Artifact Configuration.
Configure the fields as shown below.
Step 2 - Create the Processor Script
Next, create a new Script Include called:
LF_Contract_SLA
Use the following script:
var LF_Contract_SLA = Class.create();
LF_Contract_SLA.prototype = Object.extendsObject(global.LFArtifactProcessorSNC, {
category: 'localization_framework', // DO NOT REMOVE THIS LINE!
/**********
* Extracts the translatable content for the artifact record
*
* @Param params.tableName The table name of the artifact record
* @Param params.sysId The sys_id of the artifact record
* @Param params.language Language into which the artifact has to be translated (Target language)
* @return LFDocumentContent object
**********/
getTranslatableContent: function(params) {
/**********
* Use LFDocumentContentBuilder to build the LFDocumentContent object
* Use the build() to return the LFDocumentContent object
**********/
var tableName = params.tableName;
var sysId = params.sysId;
var language = params.language;
var groupName = '';
var lfDocumentContentBuilder = new global.LFDocumentContentBuilder("v1", language, sysId, tableName);
var ContSLA = new GlideRecord('contract_sla');
if (ContSLA.get(sysId)) {
lfDocumentContentBuilder.processTranslatableFieldsForSingleRecord(ContSLA,ContSLA.getDisplayValue(),'name');
}
return lfDocumentContentBuilder.build();
},
/**********
* Uncomment the saveTranslatedContent function to override the default behavior of saving translations
*
* @Param documentContent LFDocumentContent object
* @return
**********/
/**********
saveTranslatedContent: function(documentContent) {},
**********/
type: 'LF_Contract_SLA'
});
Step 3 - Create the UI Action
The easiest approach is to copy the existing Request Translations UI Action provided by Localization Framework.
Update the following values:
- Table = SLA Definition (contract_sla)
- Condition =
new global.LFTaskUtils().showUIAction('contract_sla')
Step 4 - Configure Localization Workspace
If your instance uses Localization Workspace, make sure it has been fully configured before testing.
In particular:
- Convert Settings to Projects
- Configure a valid Language Provider
- Ensure the target language has been configured
Without these steps, translation requests cannot be processed successfully.
Step 5 - Request the Translation
Open an SLA Definition record.
Click Request Contract SLA Translation.
Select the target language and submit the translation request.
Once the request has been submitted, navigate to Localization Workspace.
Locate the newly created translation request under My Requests.
Open the corresponding Localization Project.
Complete the translation by providing the translated values for all extracted strings.
Once all translations have been completed, click Publish Translations.
Step 6 - Validate the Result
Switch your user session to the translated language.
Filter the list using the translated SLA Definition name.
The translated value should now be available when filtering the Incident SLA database view.
Before you begin, make sure that:
- Localization Framework is installed.
- Localization Workspace is configured (if you're using it).
- A Language Provider has been configured.
- You have the required roles to create Artifact Configurations, Script Includes, and UI Actions.
Final Thoughts...
Custom artifacts are a great way to extend Localization Framework when an out-of-the-box artifact isn't available.
Using the approach described in this article, you can build your own artifact and continue using the standard Localization Framework translation process for additional tables.
If you have any questions or would like to share your own experience, feel free to leave a comment below.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.