SCION Workbench Client - v1.0.0-beta.35
    Preparing search index...

    Class WorkbenchTextServiceAbstract

    Provides texts from micro applications.

    Applications can register a text provider using WorkbenchClient.registerTextProvider to provide texts to other applications.

    To get texts from another application, the application must declare an intention:

    {
    "type": "text-provider",
    "qualifier": {
    "provider": "<APP_SYMBOLIC_NAME>" // Replace with the symbolic name of the providing application
    }
    },
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Gets the text for given Translatable from the specified application. Text requests are cached.

      A Translatable is a string that, if starting with the percent symbol (%), is passed to the specified application for translation, with the percent symbol omitted. Otherwise, the text is returned as is.

      Interpolation parameters can either be passed via options or appended to the translatable in matrix notation. If appended to the translatable, semicolons must be escaped with two backslashes (\\;).

      Parameters

      • translatable: undefined | string

        Specifies the translatable.

      • options: {
            params?: Map<string, unknown> | Record<string, unknown>;
            provider: string;
            ttl?: number;
        }

        Options for requesting the text.

        • Optionalparams?: Map<string, unknown> | Record<string, unknown>

          Parameters for text interpolation.

        • provider: string

          Application that provides the text.

        • Optionalttl?: number

          Time to retain texts in the cache after the last subscriber unsubscribes, in milliseconds. Defaults to the next animation frame.

      Returns Observable<undefined | string>

      Observable emitting the requested text or undefined if not found. Localized texts are emitted in the current language, and each time when the language changes. If an error occurs, the observable emits the passed translation key and then completes. The error is not propagated.

      Beans.get(WorkbenchTextService).text$('%key', {provider: 'app'});
      
      Beans.get(WorkbenchTextService).text$('%key;param1=value1;param2=value2', {provider: 'app'});

      // Alternatively, parameters can be passed via options.
      Beans.get(WorkbenchTextService).text$('%key', {params: {param1: 'value1', param2: 'value2'}, provider: 'app'});