@tabuckner/doggo-translator-ts
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.3 • Public • Published

    Doggo-Translator-TS

    Travis (.com) Codecov GitHub language count GitHub commit activity GitHub contributors styled with prettier Donate

    A TypeScript library for translating words to 'Doggo' speak!

    StackBlitz Demo

    Usage

    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.

    Basic Use Case

    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!'))

    User Defined Translations

    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.

    Browser

    To use in Browser, check out the this example

    Node

    To use in Node, check out the this example

    Features

    User Supplied Translation Definitions

    You can pass a TranslationMapInterface compliant object to the DoggoTranslatorConfig when instantiating to supply new translations on the fly.

    Word Swaps

    Entire words can be swapped, as expected.

    Suffix Swaps

    Optionally you can supply 'suffixes' to be swapped at the end of words.

    Importing library

    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'

    Public API

    TypeDoc Documentation

    translateSentence

    getAllLanguageTokens

    setLanguage

    License

    This application is released under the MIT license.

    Inspired By

    DoggoTranslator (core) 🐶

    Install

    npm i @tabuckner/doggo-translator-ts

    DownloadsWeekly Downloads

    5

    Version

    0.0.3

    License

    MIT

    Unpacked Size

    127 kB

    Total Files

    57

    Last publish

    Collaborators

    • tabuckner