@kong-ui-public/i18n 0.2.9-pr.150.f69171d.0 → 0.3.1-pr.147.12be108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -260,14 +260,43 @@ In some cases we do not have access to the Vue `app` and cannot relay on registe
|
|
|
260
260
|
</template>
|
|
261
261
|
|
|
262
262
|
<script setup lang="ts">
|
|
263
|
-
import { createI18n,
|
|
263
|
+
import { createI18n, i18nTComponent } from '@kong-ui-public/i18n'
|
|
264
264
|
import english from './locales/en.json'
|
|
265
265
|
|
|
266
266
|
const i18n = createI18n('en-us', english)
|
|
267
267
|
const i18nT = i18nTComponent(i18n)
|
|
268
268
|
|
|
269
269
|
</script>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Or in old `defineComponent` way
|
|
270
273
|
|
|
274
|
+
```html
|
|
275
|
+
|
|
276
|
+
<template>
|
|
277
|
+
<i18n-t
|
|
278
|
+
:i18n="i18n"
|
|
279
|
+
tag="h1"
|
|
280
|
+
keypath="global.default">
|
|
281
|
+
<a href="https://google.com">Google</a>
|
|
282
|
+
</i18n-t>
|
|
283
|
+
</template>
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
<script lang="ts">
|
|
287
|
+
import { defineComponent } from 'vue'
|
|
288
|
+
import { createI18n, i18nTComponent } from '../src'
|
|
289
|
+
import english from './locales/en.json'
|
|
290
|
+
|
|
291
|
+
export default defineComponent({
|
|
292
|
+
components: { i18nT: i18nTComponent() },
|
|
293
|
+
setup() {
|
|
294
|
+
return {
|
|
295
|
+
i18n: createI18n('en-us', english)
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
</script>
|
|
271
300
|
```
|
|
272
301
|
|
|
273
302
|
## Formatting numbers, dates and times
|