-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular.example.js
More file actions
23 lines (20 loc) · 904 Bytes
/
angular.example.js
File metadata and controls
23 lines (20 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Use import from "hsa-js"
// import HtmlStringsAffixer from "hsa-js";
import HtmlStringsAffixer from './../src/htmlStringsAffixer.js';
// Example of using HtmlStringsAffixer in an Angular template
const angularTemplateContent = `
<div>
<h1>Welcome to our website</h1>
<p>{{ stayEnjoyment }}</p>
<a (click)="contactUs()">Contact us</a>
</div>
`;
const affixer = new HtmlStringsAffixer({
prefix: "{{ '", // Prefix to add before string
suffix: "' | translate }}", // Suffix to add after string
ignore: ["#", "_", ">", "^", "*", "=", "(", ")"], // Added parentheses and "@" for Angular event bindings
warnings: ["%", "{", "}", "$", "'"], // Removed parentheses from warning characters
extractions: ["text"], // Since we have only texts
});
const localizedAngularContent = affixer.affixIt(angularTemplateContent);
console.log(localizedAngularContent);