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
Copy file name to clipboardExpand all lines: packages/vite-plugin-translate/README.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,19 @@ export default defineConfig({
21
21
plugins: [
22
22
ViteTranslatePlugin({
23
23
version: '4.0.3',
24
+
initializeScript: `
25
+
translate.language.setLocal('english');
26
+
translate.execute();
27
+
`,
24
28
}),
25
29
],
26
30
})
27
31
```
28
32
29
33
`ViteTranslatePlugin` will read `bundle/<version>/translate.js` from the installed package, emit it to the build output with a version and timestamp in the file name, and inject the script tag into HTML automatically.
30
34
35
+
When `initializeScript` is provided, the plugin injects it as a second script tag after `translate.js`, so the initialization code runs only after `translate.js` has been loaded and executed.
0 commit comments