You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run `yarn build i18n:extract`, and languages defined in `config.langsKeyToGenerate` in gulpfile.js will be updated to `./i18n/` . This operation will not discard the old translations.
17
17
18
-
After translated strings in the i18n folder, run `yarn build` with environment variable `COMPILE_LANG` will generate the compiled HTML in `./dist/` .
18
+
After translated strings in the i18n folder, run `yarn build` with environment variable `COMPILE_LANG` will generate the compiled HTML in `./dist/` .
19
+
20
+
## How to use i18n-id
21
+
22
+
```html
23
+
<divi18n-id="id1">content</div>
24
+
```
25
+
26
+
Adding the `i18n-id` attribute for a tag can control whether the tag will be rendered given compile-time option `COMPILE_ID`, e.g. the following command would render the tag whereas when `COMPILE_ID=id2` the tag would not be included.
27
+
28
+
```
29
+
COMPILE_ID=id1 yarn build
30
+
```
31
+
32
+
Note that when `COMPILE_ID=''` or when this option is not provided, all id are assumed and all contents are rendered.
33
+
34
+
```html
35
+
<divi18n-id="id1"i18n-if="zh">content</div>
36
+
```
37
+
38
+
Another advanced usage example. When `COMPILE_ID=id1` and `COMPILE_LANG=zh` the tag would be shown.
0 commit comments