1.0.0-rc.14 • Published 5 months ago
@kevinmarrec/cloudstack-vue-i18n v1.0.0-rc.14
@kevinmarrec/cloudstack-vue-i18n
Description
Opinionated Internationalization (i18n) Vue plugin.
Opinions
Lazy loading of locales
- Supports JSON
- Supports YAML (with optional requirement: vite-plugin-yaml)
Fallbacking
- Configure which locale to use when your preferred language lacks a translation
- If the fallback locale also lacks the translation, the key will be returned as is
Message Format features
Standard & nested keys
t('foo')resolvesfoot('foo.bar')resolvesfoo➡️bart('foo.bar.baz')resolvesfoo➡️bar➡️baz
Named interpolation
Hello {name}+t('key', { name: 'John' })=Hello John
List interpolation
Hello {0} {1}+t('key', ['John', 'Doe'])=Hello John Doe
Pluralization
car | cars+t('key', 0)=carscar | cars+t('key', 1)=carcar | cars+t('key', 2)=carsno apples | one apple | {count} apples+t('key', 0)=no applesno apples | one apple | {count} apples+t('key', 1)=one appleno apples | one apple | {count} apples+t('key', 2)=2 apples
Supports Server-Side Rendering (SSR) & Static Site Generation (SSG)
Usage
This package is mainly meant to be internally used by Cloudstack Vite.
The
createI18nfunction returns aPromisethat resolves to the i18n plugin, so you must asynchronously use it in your app.This is required to ensure the following behaviors:
- Client-side rendering (CSR) lazy loads the base & fallback locales when rendering the app.
- Server-side rendering (SSR) loads the base & fallback locales before rendering the app.
<script setup lang="ts">
import { useI18n } from '@kevinmarrec/cloudstack-vue-i18n'
const { t } = useI18n()
</script>
<template>
<div>{{ t('welcome') }}</div>
</template>1.0.0-rc.14
5 months ago
1.0.0-rc.13
5 months ago
1.0.0-rc.12
5 months ago
1.0.0-rc.11
6 months ago
1.0.0-rc.10
6 months ago
1.0.0-rc.9
7 months ago
1.0.0-rc.8
7 months ago
1.0.0-rc.7
7 months ago
1.0.0-rc.6
8 months ago
1.0.0-rc.5
8 months ago
1.0.0-rc.4
8 months ago
1.0.0-rc.3
8 months ago
1.0.0-rc.2
8 months ago
1.0.0-rc.1
8 months ago
1.0.0-beta.10
8 months ago
1.0.0-beta.9
8 months ago