2.3.0 • Published 9 months ago

@nitra/tfm v2.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@nitra/tfm

usage with Vite

Default language can be set in:

import.meta.env.VITE_TFM_DEFAULT

If VITE_TFM is set, store will be disable

example in web:

<template>
  <div>Мова: {{ langStore.code }}</div>
  <button @click="setEnglish()">Set english (base)</button>
  <button @click="setLatvian()">Set latvian</button>
  <button @click="setUkrainian()">Set ukrainian</button>
  <div>{{ t`Hello Sun ${langStore.code} !` }}</div>
  <router-view />
</template>

<script setup>
import tf from '@nitra/tfm'
import { useLangStore } from '@nitra/tfm/store'

const langStore = useLangStore()

const tr = {
  'Hello Sun ': { uk: 'Привіт Сонечко ', lv: 'Sveika Saulīte ', ee: 'Tere Päike ' }
}

const t = tf.bind({ tr })

const setEnglish = () => {
  langStore.code = 'en'
}

const setUkrainian = () => {
  langStore.code = 'uk'
}

const setLatvian = () => {
  langStore.code = 'lv'
}
</script>
2.3.0

9 months ago

2.2.0

9 months ago

2.1.0

9 months ago

2.0.0

9 months ago

1.7.0

10 months ago

1.6.0

11 months ago

1.5.0

12 months ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.2.1

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago