GitHub - Makio64/vue-tiny-translation (original) (raw)
Vue Tiny Translation 🌍✨
A minimalist reactive translation plugin for Vue 3. Super lightweight (0.32KB gzipped), simple, and efficient internationalization solution.
🌐 Live Demo - Try it now
Features
- 🚀 Tiny: Minimal footprint, maximum performance
- ⚡ Reactive: Automatically updates components when translations change, no page reload!
- 🔧 Simple API: Super easy to use with intuitive methods
- 🌐 Dynamic Loading: Load translations asynchronously
- 📦 TypeScript Support: Full TypeScript definitions included
Installation
npm install vue-tiny-translation
Quick Start
1. Install the plugin
import { createApp } from 'vue' import TinyTranslation from 'vue-tiny-translation' import App from './App.vue'
const app = createApp(App) app.use(TinyTranslation) app.mount('#app')
2. Load translations and use in components
{{ $t('hello') }}
{{ $t('goodbye') }}
Change LanguageLoad translation files from anywhere
// Load from anywhere await loadTranslations('/translations/en.json') // Local files await loadTranslations('/api/translations/en') // API endpoints
Example of organization using local files
public/translations/
en.json
fr.json
de.json
{ "hello": "Hello", "goodbye": "Goodbye" }
API
$t(key, fallback?)- Translate in templatestranslate(key, fallback?)- Translate in JavaScriptloadTranslations(path)- Load translations from any source
Demo & Testing
🌐 Live Demo - Try it now !
Local Testing: Clone and run the example locally:
cd example npm install npm run dev
Open http://localhost:5173 and see the plugin working with automatic language detection!
License
MIT © Makio64