Options
All
  • Public
  • Public/Protected
  • All
Menu

Given a language.json object, returns an instance of DoggoTranslator.

Hierarchy

  • DoggoTranslator

Implements

Index

Constructors

constructor

Properties

defaultLanguage

defaultLanguage: english = LANGUAGE_TOKENS_ENUM.english

defaultResponse

defaultResponse: "Bork" = "Bork"

Private languageToken

languageToken: string

Private localeLoaderService

localeLoaderService: LocaleLoaderService = new LocaleLoaderService()

Methods

Private capitalizeFirstCharacter

  • capitalizeFirstCharacter(target: string): string

Private configValidation

Private escapeRegex

  • escapeRegex(target: string): string
  • Given a string, returns the string with all special characters escaped so that the translation regex see them as special characters.

    Parameters

    • target: string

      The string to escape

    Returns string

getAllLanguageTokens

  • getAllLanguageTokens(): string[]

Private languageAvailable

Private replaceSuffixes

  • replaceSuffixes(suffixes: object, reverse: boolean, sourceSentence: string): string

Private replaceWholeWords

  • replaceWholeWords(words: object, reverse: boolean, sourceSentence: string): string

setLanguage

Private setUpTranslator

Private transformSuffixes

  • transformSuffixes(input: string, regex: string, replace: string): string

translateSentence

  • translateSentence(sourceSentence: string, reverse?: boolean): string
  • Parameters

    • sourceSentence: string

      Sentence in the sourceLanguage

    • Default value reverse: boolean = false

      boolean to control direction of translation (e.g. true = sourceLanguage => doggo, false = doggo => sourceLanguage)

    Returns string

Private translateWholeWord

  • translateWholeWord(input: string, regex: string, replace: string): string
  • Replaces a part from the input and tries to format it with the proper case.

    Parameters

    • input: string

      The complete input

    • regex: string
    • replace: string

      The word or sentence to replace the found word or sentence

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc