JSPM

@nitra/tfm-node

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 210
  • Score
    100M100P100Q88093F
  • License MIT

Node translate helper

Package Exports

  • @nitra/tfm-node

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 })