t7e

T7e ===

npm install t7e
1 downloads in the last week
23 downloads in the last month

T7e

Basic usage

translate = require 't7e'
translate.load greetings: hello: 'Hello', hey: 'Hey, $name!'
translate 'greetings.hello'
# 'Hello'
translate 'span', 'greetings.hello'
# '<span data-t7e-key="greetings.hello">Hello</span>'

translate 'span', 'greetings.hey', $name: 'you'
# '<span data-t7e-key="greetings.hey" data-t7e-name="you">Hey, you!</span>'
translate.load greetings: hey: '¡Hola, $name!'
translate.refresh()

Language-picker menu

new t7e.Menu
  languages:
    'en-US':
      label: 'U.S. English'
      value: {}
    'es-MX':
      label: 'Español mexicano'
      value: './es-mx.json'

Language codes should match the codes returned by navigator.language.

npm loves you