@ewb/translate
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "@ewb/translate", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Translate as you create your app. Saves the words and text in a tree structure for fast and easy lookup.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -18,3 +18,10 @@ # Translate library | ||
``` | ||
const translation = new Translation({ | ||
npm install @ewb/translate | ||
yarn add @ewb/translate | ||
``` | ||
``` | ||
const Translate from '@ewb/translate'; | ||
const translate = new Translate({ | ||
defaultLocale: 'en', | ||
@@ -74,11 +81,11 @@ locale: 'no-nb', | ||
``` | ||
translation.word('Word'); // Ord | ||
translation.text('This is a sentence'); // Dette er en setning | ||
translate.word('Word'); // Ord | ||
translate.text('This is a sentence'); // Dette er en setning | ||
translation.word('Word', 'en'); // Word | ||
translation.text('This is a sentence', 'en'); // Dette er en setning | ||
translate.word('Word', 'en'); // Word | ||
translate.text('This is a sentence', 'en'); // Dette er en setning | ||
translation.setLocale('en'); | ||
translation.word('Worry') // Worry | ||
translation.text('This is not a sentence') // This is not a sentence | ||
translate.setLocale('en'); | ||
translate.word('Worry') // Worry | ||
translate.text('This is not a sentence') // This is not a sentence | ||
``` | ||
@@ -98,3 +105,3 @@ | ||
``` | ||
new Translate({ | ||
const translate = new Translate({ | ||
...., | ||
@@ -104,3 +111,3 @@ noWord: (translate: Translate, empty: Empty) => { ... Handle 'N/W' }, | ||
}) | ||
tranlsate('No match') | ||
translate('No match') | ||
``` | ||
@@ -107,0 +114,0 @@ |
32218
218