Skip to content

Commit 9d86cdb

Browse files
author
Sebi Nemeth
committed
update readme
1 parent 15ad225 commit 9d86cdb

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
# Live Translator Plugin
1+
# Live Translator Plugin for Vue i18n
22
> [!WARNING]
33
> Plugin has been updated to Vue 3 only. To use with Vue 2 please use the legacy `vue2` branch.
44
5+
> [!WARNING]
6+
> 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.
7+
58
## Demo
69
Find a live demo app at: [https://apicore-engineering.github.io/vue-i18n-live-translator-plugin/](https://apicore-engineering.github.io/vue-i18n-live-translator-plugin/)
710

@@ -11,10 +14,27 @@ npm i -s https://github.com/apicore-engineering/vue-i18n-live-translator-plugin
1114
```
1215

1316
## Use
17+
Encode locale messages before passing them to `createI18n`:
1418
```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:
29+
```typescript
30+
// main.ts
1531
import { LiveTranslatorPlugin, TranslationMeta } from 'vue-i18n-live-translator-plugin'
1632

17-
Vue.use(LiveTranslatorPlugin, {
33+
// const app = createApp(App)
34+
// app.use(i18n)
35+
// ...
36+
37+
app.use(LiveTranslatorPlugin, {
1838
translationLink (meta: TranslationMeta) {
1939
return '' // your platform-specific link to the translation software
2040
},

0 commit comments

Comments
 (0)