https://github.com/tabuckner/doggo-translator-ts
A typescript doggo translator based on DoggoTranslatorCore
https://github.com/tabuckner/doggo-translator-ts
Last synced: over 1 year ago
JSON representation
A typescript doggo translator based on DoggoTranslatorCore
- Host: GitHub
- URL: https://github.com/tabuckner/doggo-translator-ts
- Owner: tabuckner
- License: mit
- Created: 2019-10-01T19:54:05.000Z (over 6 years ago)
- Default Branch: develop
- Last Pushed: 2022-12-10T04:17:44.000Z (over 3 years ago)
- Last Synced: 2025-02-26T13:24:24.889Z (over 1 year ago)
- Language: TypeScript
- Size: 1.13 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
# Doggo-Translator-TS





[](https://github.com/prettier/prettier)
[](https://paypal.me/tabuckner)
A TypeScript library for translating words to 'Doggo' speak!
### Usage
You can use the library defaults by creating an instance of the [DoggoTranslator](https://tabuckner.github.io/doggo-translator-ts/classes/doggotranslator.html) class, and using it's publicly available methods. [Read More](./examples/node/index.js)
Optionally you can pass in a [DoggoTranslatorConfig](https://tabuckner.github.io/doggo-translator-ts/interfaces/doggotranslatorconfig.html) object to configure the instance when created.
#### Basic Use Case
```javascript
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
```javascript
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](./examples/browser/index.html)
#### Node
To use in Node, check out the [this example](./examples/node/index.js)
### 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:
```typescript
import myLib from 'mylib'
```
Additionally, you can import the transpiled modules from `dist/lib` in case you have a modular library:
```typescript
import something from 'mylib/dist/lib/something'
```
### Public API
[TypeDoc Documentation](https://tabuckner.github.io/doggo-translator-ts/)
[translateSentence](https://tabuckner.github.io/doggo-translator-ts/classes/doggotranslator.html#translatesentence)
[getAllLanguageTokens](https://tabuckner.github.io/doggo-translator-ts/classes/doggotranslator.html#getalllanguagetokens)
[setLanguage](https://tabuckner.github.io/doggo-translator-ts/classes/doggotranslator.html#setlanguage)
## License
This application is released under the [MIT license](https://github.com/Gabbersaurus/DoggoTranslatorCore/blob/master/LICENSE).
## Inspired By
[DoggoTranslator (core) :dog:](https://gabbersaurus.github.io/DoggoTranslator/)