Skip to content

anderson-cubo/dothraki-js

Repository files navigation

With Dothraki-JS you can start translating your app.

Getting started

$ npm install https://github.com/anderson-cubo/dothraki-js

Creating dictionary

import { settings } from 'dothraki-js'

const PT_BR_dictionary = {
  'Hi': 'Olá',
  'Welcome', 'Bem-Vindo'
}

settings.setDictionary('PT_BR', PT_BR_dictionary)

Using Dictionary

import { settings } from 'dothraki-js'

settings.set('language', 'PT_BR')

Getting words that are not being translated

import { settings } from 'dothraki-js'

settings.getDictionaryWithoutTranslation()

Disabling Warnings

import { settings } from 'dothraki-js'

settings.set('_ENABLE_WARNINGS', false)

Translating words

import dothraki from 'dothraki-js'

console.log(dothraki`Hi`)

Setting params inside dictionary

import { settings } from 'dothraki-js'

const PT_BR_dictionary = {
  'Welcome, {{0}}': 'Bem-Vindo, {{0}}'
}

settings.setDictionary('PT_BR', PT_BR_dictionary)

Using params

import dothraki from 'dothraki-js'

const user = 'John'

dothraki`Welcome, ${user}`

Using JSX in Params

import dothraki from 'dothraki-js'

const user = 'John'

dothraki`Welcome, ${<span>{user}</span>}`

About

Javascript translation built for REACT

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published