npm.io
1.3.1 • Published 2 years ago

@nitra/tf

Licence
MIT
Version
1.3.1
Deps
0
Size
3 kB
Vulns
0
Weekly
0

@nitra/tf

usage with Vite (set import.meta.env.VITE_T to activate translation):

import tf from '@nitra/tf'

const tr = {
  'Привіт': 'Hello',
}

const t = tf.bind({ tr })

t`Привіт` // Hello

usage node (set process.env.VITE_T to activate translation):

import tf from '@nitra/tf'

const tr = {
  'Привіт': 'Hello',
}

const t = tf.bind({ tr })

t`Привіт` // Hello

usage webpack (set process.env.VITE_T to activate translation):

import tf from '@nitra/tf/webpack'

const tr = {
  'Привіт': 'Hello',
}

const t = tf.bind({ tr })

t`Привіт` // Hello

usage without environment variable:

import tf from '@nitra/tf/t'

const tr = {
  'Привіт': 'Hello',
}

const t = tf.bind({ tr, t: 1 })

t`Привіт` // Hello

Keywords