All files / src/app/touchpad/speech-processing utils.ts

100% Statements 3/3
100% Branches 2/2
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54      1x 1x 1x                                                                                                
/**
 * The languages available in the application.
 */
export enum Language {
  ENGLISH = 'english',
  FRENCH = 'french'
}
 
/**
 * The identifiers of the languages available in the application.
 */
export const languageIds: {[lang in Language]: string} = {
  [Language.ENGLISH]: 'en-GB',
  [Language.FRENCH]: 'fr-FR'
};
 
/**
 * The languages associated to the TranslateService language identifiers.
 */
export const translateLanguages: {[key: string]: Language} = {
  en: Language.ENGLISH,
  fr: Language.FRENCH
};
 
/**
 * The TranslateService language identifiers associated to the application's languages.
 */
export const languagesTranslate: {[Language.ENGLISH]: string, [Language.FRENCH]: string} = {
  [Language.ENGLISH]: 'en',
  [Language.FRENCH]: 'fr'
};
 
/**
 * The languages recognised by speech recognition.
 */
export const recognisedLanguages: {[key: string]: Language } = {
  english: Language.ENGLISH,
  anglais: Language.ENGLISH,
  francais: Language.FRENCH,
  français: Language.FRENCH,
  french: Language.FRENCH
};
 
/**
 * The interface for speech recognition voice commands:
 * - 'commands' indicates the text of the different commands to be recognised in
 *   order to perform a specific action;
 * - 'callback' is the function to execute when a command has been recognised.
 */
export interface VoiceCommand {
  commands: string[];
  callback: (param?: string) => void;
}