File

projects/core/src/i18n/translation.service.ts

Index

Properties

Properties

loadChunks
Type : function

Loads chunks with translations

Parameters :
Name Description
chunkNames

array of chunk names to be loaded

translate
Type : function

Translates given key with options. If key is missing, it tries to load the chunk and emits a value when chunk is loaded. If key is missing after loaded chunk, a fallback value is emitted

Parameters :
Name Description
key

translation key

options

values for interpolation in translation

whitespaceUntilLoaded

if true, immediately emits a non-breaking space

import { Observable } from 'rxjs';

export abstract class TranslationService {
  /**
   * Translates given key with options.
   * If key is missing, it tries to load the chunk and emits a value when chunk is loaded.
   * If key is missing after loaded chunk, a fallback value is emitted
   *
   * @param key translation key
   * @param options values for interpolation in translation
   * @param whitespaceUntilLoaded if true, immediately emits a non-breaking space
   */
  translate: (
    key: string,
    options?: any,
    whitespaceUntilLoaded?: boolean
  ) => Observable<string>;

  /**
   * Loads chunks with translations
   *
   * @param chunkNames array of chunk names to be loaded
   */
  loadChunks: (chunkNames: string | string[]) => Promise<any>;
}

result-matching ""

    No results matching ""