@@ -68,6 +68,21 @@ const output = template.render();
6868// <h1>Hello world</h1>
6969```
7070
71+ ## Custom filter names
72+
73+ By default, the filter names ` t ` and ` trans ` are supported. You can overwrite or extend these names with the ` filterNames ` option:
74+
75+ ``` js
76+ import Twig from " twig" ;
77+ import { twigDrupalString } from " twig-drupal-string" ;
78+
79+ twigDrupalString ({
80+ Twig,
81+ files: [" strings.yaml" ],
82+ filterNames: [" t" , " trans" , " tc" ],
83+ });
84+ ```
85+
7186## Watch mode
7287
7388For development purposes, a watch mode can be enabled that reloads the translation strings from disk if any of the referenced files change.
@@ -86,11 +101,12 @@ twigDrupalString({
86101
87102The ` twigDrupalString ` method receives an options object with the following properties:
88103
89- | Property | Type | Description |
90- | -------- | ---------- | --------------------------------------------- |
91- | ` Twig ` | ` Twig ` | Twig.js engine instance |
92- | ` files ` | ` string[] ` | Array of paths to translation string files |
93- | ` watch ` | ` boolean ` | Enable or disable watch mode, default ` false ` |
104+ | Property | Type | Description |
105+ | ------------- | ---------- | ------------------------------------------------------ |
106+ | ` Twig ` | ` Twig ` | Twig.js engine instance |
107+ | ` files ` | ` string[] ` | Array of paths to translation string files |
108+ | ` filterNames ` | ` string[] ` | Array of filter name strings, default ` ["t", "trans"] ` |
109+ | ` watch ` | ` boolean ` | Enable or disable watch mode, default ` false ` |
94110
95111## Contributing
96112
0 commit comments