A TypeScript library for translating words to 'Doggo' speak!
You can use the library defaults by creating an instance of the DoggoTranslator class, and using it's publicly available methods. Read More
Optionally you can pass in a DoggoTranslatorConfig object to configure the instance when created.
const library = require('../dist/doggo-translator-ts.umd');
const DoggoTranslator = library.DoggoTranslator;
const myTranslator = new DoggoTranslator();
console.warn(myTranslator.translateSentence('Testing this, bark!'))
console.warn(myTranslator.translateSentence('Hello friend! I hope you have a great day!'))
const library = require('../dist/doggo-translator-ts.umd');
const DoggoTranslator = library.DoggoTranslator;
const myTranslations ={
words: {
hey: 'hi',
friend: 'frenn',
run: 'floop'
},
suffixes: {
ing: 'in'
}
}
const myTranslator = new DoggoTranslator({ userDefinedTranslations: myTranslations });
const text = 'Hey Friend! Do you want to go run around? I love running!';
const translated = myTranslator.translateSentence(text)
console.warn(translated); // Hi frenn! Do you want to go floop around? I love runnin.
To use in Browser, check out the this example
To use in Node, check out the this example
You can pass a TranslationMapInterface
compliant object to the DoggoTranslatorConfig
when instantiating to supply new translations on the fly.
Entire words can be swapped, as expected.
Optionally you can supply 'suffixes' to be swapped at the end of words.
You can import the generated bundle to use the whole library generated by this starter:
import myLib from 'mylib'
Additionally, you can import the transpiled modules from dist/lib
in case you have a modular library:
import something from 'mylib/dist/lib/something'
This application is released under the MIT license.