@nitra/tfm-node
v1.0.2
Published
Node translate helper
Downloads
587
Readme
@nitra/tfm-node
usage with node
ENV TFM
import tf from '@nitra/tfm-node'
import Fastify from 'fastify'
const fastify = Fastify()
const tr = {
'Привіт Сонечко ': { en: 'Hello Sun ', lv: 'Sveika Saulīte ', ee: 'Tere Päike ' }
}
// Declare a route
fastify.post('/', {}, function (req, reply) {
console.log(req.headers.lang)
const t = tf.bind({ tr, lang: req.headers.lang })
reply.send({ result: t`Привіт Сонечко ${Date.now()} without trans ${0}` })
})
// Run the server!
fastify.listen({ port: 3000 })