Skip to content
Javascript translation built for REACT
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.babelrc
.editorconfig
.gitignore
README.md
index.js
package-lock.json
package.json
webpack.config.js

README.md

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>}`
You can’t perform that action at this time.