Skip to content

Commit 0448984

Browse files
author
Sebi Nemeth
committed
update readme
1 parent 17fcf32 commit 0448984

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

README.md

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# Live Translator Plugin for Vue i18n
2-
> [!WARNING]
3-
> Plugin has been updated to Vue 3 only. To use with Vue 2 please use the legacy `vue2` branch.
4-
52
> [!WARNING]
63
> This plugin makes significant changes to the DOM, possibly messing up your layout and appearance. We advise you **NOT TO USE IT IN PRODUCTION**, only in development and staging instances.
74
@@ -14,32 +11,27 @@ npm i -s https://github.com/apicore-engineering/vue-i18n-live-translator-plugin
1411
```
1512

1613
## Use
17-
Encode locale messages before passing them to `createI18n`:
18-
```typescript
19-
// i18n.ts
20-
import { createI18n } from 'vue-i18n'
21-
import { encodeMessages } from 'vue-i18n-live-translator-plugin'
22-
23-
export const i18n = createI18n({
24-
// ...
25-
messages: encodeMessages(messages),
26-
})
27-
```
28-
Use plugin to decode info from locale messages:
2914
```typescript
3015
// main.ts
16+
import { i18n } from './i18n'
3117
import { LiveTranslatorPlugin, TranslationMeta } from 'vue-i18n-live-translator-plugin'
3218

33-
// const app = createApp(App)
34-
// app.use(i18n)
35-
// ...
19+
const app = createApp(App)
20+
app.use(i18n)
3621

3722
app.use(LiveTranslatorPlugin, {
23+
i18n, // i18n instance
3824
translationLink (meta: TranslationMeta) {
39-
return '' // your platform-specific link to the translation software
25+
// your platform-specific link to the translation software
26+
return ''
4027
},
4128
persist: true,
29+
root: document.getElementById('app'), // root of your vue app, this is where the plugin looks for translated strings. defaults to document.documentElement
30+
refreshRate: 100, // max refresh rate (ms)
31+
checkVisibility: true, // hide elements that are covered
4232
})
33+
34+
app.mount('#app')
4335
```
4436

4537
## Weblate example

0 commit comments

Comments
 (0)