Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**Use Case**
1. Adding string in HTML template without ${} or gs.getMessage('string') in server script attracts HealthScan findings.
2. These string do not get translated in multi lingual portals.
3. This will help in ensuring internationalization. Same BR can be used in "sp_ng_template" table.

**How to use**
1. Add this code as before insert/update BR on sp_widget table.
2. The condition will be "Body HTML Changes."
3. If Internationalisation is not followed, error message will be shown and action will be aborted.

**Regex**
/>([a-zA-Z].*)<\//
This Regex check any direct string between > and </ without ${} or ::data.string or :data.string
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(function executeRule(current, previous /*null when async*/ ) {
/*
table: sp_widget
when: Before
operation: insert & update
condition : Body HTML Template Changes.
This BR will check if standard internationalisation is not followed, this is required for multi lingual portals and is flagged in health scan.
*/
var reg = />([a-zA-Z].*)<\//; // regex to check if strings are directly added in HTML Template
var regex = new RegExp(reg);
if (regex.test(current.getValue('template'))) {
gs.addInfoMessage("Please use standard inernationalisation methods for strings like ${string} or define the string in server using gs.getMessage('string')");
current.setAbortAction(true);
}

})(current, previous);
Loading