Skip to content

Element Maps

Element Maps is Element's high-level Angular map component based on OpenLayers. It provides points, grouping, clusters, labels, tooltips, and popovers out of the box.

Usage

Use Element Maps when an application needs a ready-to-use map component with Element-specific behavior instead of assembling map features individually.

When to use

  • To display and group location points with a predefined Element presentation.
  • When built-in clustering, labels, tooltips, or popovers are required.
  • When a high-level component is preferable to direct interaction with a map library.

Code

The si-map component uses the OpenLayers library. OpenLayers is a high-performance, feature-rich library for creating interactive geographical maps. It can display map tiles, vector data, and markers loaded from a wide range of sources.

The API documentation can be found in the official OpenLayers API docs, with further useful examples on the OpenLayers examples page. The source code is available in the OpenLayers GitHub repository.

For cluster functionality and other additional features, ol-ext is used. More information and documentation can be found in the ol-ext GitHub repository.

The OpenLayers ol-mapbox-style library is used to create OpenLayers maps from Mapbox Style Specification objects.

Usage

Required Packages
npm install --save @siemens/maps-ng @siemens/map-styles

# Also install the needed peer dependencies
npm install --save ol ol-ext ol-mapbox-style

Add library assets and CommonJS dependencies in angular.json under the build options:

{
  "architect": {
    "build": {
      "options": {
        "assets": [
          {
            "glob": "**/*",
            "input": "./node_modules/@siemens/maps-ng/assets",
            "output": "/assets/"
          }
        ],
        "allowedCommonJsDependencies": [
          "xml-utils/find-tags-by-name.js",
          "xml-utils/get-attribute.js",
          "web-worker",
          "pbf",
          "earcut",
          "rbush"
        ]
      }
    }
  }
}

Import the OpenLayers styles into the main global stylesheet:

@use 'ol/ol.css';

Import SiMapComponent into the component that displays the map:

import { Component } from '@angular/core';
import { SiMapComponent } from '@siemens/maps-ng';

@Component({
  selector: 'app-map',
  imports: [SiMapComponent],
  template: '<si-map maptilerKey="REPLACE_WITH_YOUR_MAPTILER_KEY" />'
})
export class MapComponent {}

Provide a MapTiler key when using the default map style:

<si-map maptilerKey="REPLACE_WITH_YOUR_MAPTILER_KEY"></si-map>

Features

Grouping

Points on the map can be grouped so they share the color provided in groupColors. While clustered, points are grouped in a donut chart.

To group points, specify the group property on a point object. The value of group is used to match the color from the default palette or groupColors, if provided. While groupColors is optional, the default color palette is status.

A custom color palette can be defined with the following code:

<si-map [points]="points" [groupColors]="{ 1: 'red', 2: 'green', 3: 'blue', 4: 'black'}"></si-map>

Accessibility of custom colors

The usage of Element color definitions is strongly recommended to fulfill accessibility standards. Involve your UX specialist when using custom colors to ensure accessibility, especially important are appropriate contrasts for different themes.

To override a group color, specify a marker color on the point object itself:

const point: MapPoint = {
  name: 'Point 1',
  lon: 11,
  lat: 10,
  group: 1,
  marker: {
    color: 'orange'
  }
};
Examples

Grouping with default status palette:

<si-map [points]="points"></si-map>
const points: MapPoint[] = [
  {
    name: 'Point 1',
    lon: 11,
    lat: 10,
    group: 1 // $element-status-information
  },
  {
    name: 'Point 2',
    lon: 11,
    lat: 10,
    group: 2 // $element-status-success
  },
  {
    name: 'Point 3',
    lon: 11,
    lat: 10,
    group: 3 // $element-status-warning
  },
  {
    name: 'Point 4',
    lon: 11,
    lat: 10,
    group: 4 // $element-status-danger
  }
];

Maps - Cluster Status Colors

Grouping with Element palette colors:

<si-map [points]="points" groupColors="element"></si-map>
const points: MapPoint[] = [
  {
    name: 'Point 1',
    lon: 11,
    lat: 10,
    group: 1 // $element-red-500 / 300 (depending on theme)
  },
  {
    name: 'Point 2',
    lon: 11,
    lat: 10,
    group: 2 // $element-orange-500
  },
  {
    name: 'Point 3',
    lon: 11,
    lat: 10,
    group: 3 // $element-blue-500
  },
  {
    name: 'Point 4',
    lon: 11,
    lat: 10,
    group: 4 // $element-yellow-500
  }
];

Maps - Cluster Element Colors

Custom Mapbox style

The map appearance can be changed by passing a custom Mapbox style to the component as the styleJson input. In this case, maptilerKey is not needed as the custom style overrides it.

<si-map [styleJson]="styleJson"></si-map>

See the official Mapbox documentation for more information.

Customize tooltip length

Customize the tooltip width with maxLabelLength:

<si-map
  class="flex-fill"
  [points]="points"
  [displayTooltipOnHover]="true"
  [maptilerKey]="maptilerKey"
>
  <si-map-tooltip [maxLabelLength]="50" />
</si-map>

Map example

SiMapComponent API Documentation

selector
si-map

Input Properties

Name Type Default Description
alwaysShowLabels
boolean false Show the label permanently next to the point. Normally the label is shown on hover or click. By enabling this it will always be visible next to the marker.
autoZoomClusterClick
boolean true When disabled, clusters will no longer automatically be zoomed to on click.
autoZoomFeatureClick
boolean false When enabled, features will be automatically zoom to on click.
cluster
boolean false Enable or disable clustering of points on the map.
clusterClickZoom
number DEFAULT_CLUSTER_CLICK_ZOOM Max zoom level for clicking on a cluster on the map. Defaults to 15.
clusterDistance
number DEFAULT_CLUSTER_DISTANCE Defines range in which points are clustered. In pixels.
clusterPopoverComponent
Type<any> Custom popover component for clustering
displayPopoverOnClick
boolean true Option to switch on/off the display of popover when clicked. Default set to true (on).
displayPopoverOnHover
boolean false Option to switch on/off popover when hovered. Default is set to false (off)
displayTooltipOnClusterHover
boolean false Option to switch on/off the display of tooltip while hovering over cluster.
displayTooltipOnHover
boolean false Option to switch on/off the display of tooltip while hovering over single point.
featureClickZoom
number DEFAULT_FEATURE_CLICK_ZOOM Max zoom level which is used when clicking on feature on the map. Defaults to 15.
featureSelectZoom
number DEFAULT_FEATURE_SELECT_ZOOM Zoom level when calling the select() method on the component. Defaults to 10.
fitClusterPadding
[ number, number, number, number ] [20, 20, 20, 20] Padding (in pixels) applied to the map view when zooming to a cluster, preventing points from being clipped at the edges. Specified as [top, right, bottom, left].
fitGeoJsonPadding
number[] [20, 20, 20, 20] For GeoJson, padding (in pixels) to be cleared to fit the GeoJson inside the view after a click on it. Values in the array are: [top, right, bottom, left].
fitPointPadding
number[] [20, 20, 20, 20] For Point geometry, padding (in pixels) to be cleared to fit the point inside the view after a click on it. Values in the array are: [top, right, bottom, left].
geoJson
any Payload of a geo-JSON object.
geoJsonProjection
string 'EPSG:3857' Projection format used to render the geo-JSON payload.
globalZoom
number DEFAULT_GLOBAL_ZOOM Max zoom level on load or when clicking the reset button. Defaults to 5.
groupColors
(Record<number, string> | ColorPalette) 'status' Defines which colors should be used when points are grouped. Grouping means that points are painted with their group color and they are displayed as series in donut chart inside cluster.
maptilerKey
string Provide your key for MapTiler, this will use the default siemens element styles which can be used in both light and dark mode. Shouldn't be used together with styleJson.
markerAnimation
boolean false Enable or disable animation of markers.
maxLabelLineLength
number 20 Maximum number of characters per line for always displayed labels of a point.
If the label exceeds this limit, it will be wrapped or trimmed.
If set to 0, label trimming will be disabled.
This setting is effective only when alwaysShowLabels is enabled.
Important: Changing this is not recommended in most cases and may cause issues with positioning of the labels.
maxLabelLines
number 3 Maximum number of lines for always displayed labels of a point.
If the label exceeds this limit, it will be trimmed.
This setting is effective only when alwaysShowLabels is enabled and maxLabelLineLength is not 0.
Important: Changing this is not recommended in most cases and may cause issues with positioning of the labels.
multiWorld
boolean true Show multiple worlds, including points that cross the 180th meridian.
nativeProperties
OverlayNativeProperties - overlay: Layer for popup element, an element to be displayed over the map and attached to a single map location. - controls: List of controls to activate for map, additional controls like full screen, etc. can be added here.
points
MapPoint[] Points to be rendered on the map as features.
popoverCloseOnClick
boolean true Close the popover on click
popoverComponent
Type<any> Custom popover component
popoverComponentProps
any Custom popover component
styleFunction
StyleLike Callback function to add custom styling to the drawn geo-JSON features.
styleJson
any Type of background map, for example 'https://api.maptiler.com/maps/voyager/style.json?key=xxx' (Token key is required). The styleJson defines the tiler source and the used styles for different layers, should only be used if the siemens default styles by using maptilerKey isn't good enough.

Output Properties

Name Type Description
pointsChange
MapPoint[] Points to be rendered on the map as features.
pointsRefreshed
void Emitted when the points are available as features. So consumers can call methods like zoomToPoints() on the actual point list.
pointsSelected
MapPoint[] Emitted when points on the map are selected or de-selected

Methods

Name Type Description
clear clear() => void Remove all points from map.
refresh refresh(points: MapPoint[]) => void Updates the map with new set of points provided in argument.
select select(point: MapPoint) => void Zoom in the provided point and display popover with additional information.

MapTiler API key

Element Maps currently supports MapTiler as an OSM tile source. An API key is required to use this service. The API key is unique per project and its use is limited to certain URLs through an HTTP Origin Header allow-list.

As with most map services, commercial use of the API is a paid service and requires an account with an active subscription. Element does not provide such an account for all of Siemens.

Testing

When running automated tests, do not load map tiles. This drastically reduces the number of MapTiler requests, which are limited by contract. Tests should cover the application's map functionality rather than the map data.

  • Unit tests: Do not provide an API key.
  • Playwright tests: Stub the tiles.json request and related requests using page.route(...).

Security considerations

The description of a map point can contain HTML and is rendered in the popover. Angular sanitizes this value. Do not pass untrusted content that was marked as trusted (e.g. via bypassSecurityTrustHtml). The point name is rendered as plain text.

Types Documentation

15 = 15
Variable
40 = 40
Variable
15 = 15
Variable
5 = 5
Variable
("status" | "element")
Properties
List of controls to activate for map, additional controls like full screen, etc. can be added here Defaults are zoom in and out
controls?: Control[]
Layer for popup element, an element to be displayed over the map and attached to a single map location.
overlay?: Overlay
Properties
Marker description, can be simple string or HTML as string
description: string from description
Extra properties to be passed along (click function consumes it)
extraProperties?: any from extraProperties
If you want your point to be clustered by it's group, you need to set the group id here for this point Color with the same id will be assigned. Must be higher than 0
group?: number from group
Latitude value for marker
lat: number
Longitude value for marker
lon: number
Marker style
marker?: MarkerOptions from marker
Marker name
name: string from name
Methods
(extraProperties: any) => void from click
Click functionality, do any extra staff when clicking on the point, just create needed logic for click functionality
Parameters
extraProperties?: any
import
imported from ol
Properties
Marker description, can be simple string or HTML as string
description: string
Extra properties to be passed along (click function consumes it)
extraProperties?: any
If you want your point to be clustered by it's group, you need to set the group id here for this point Color with the same id will be assigned. Must be higher than 0
group?: number
Marker style
marker?: MarkerOptions
Marker name
name: string
Methods
(extraProperties: any) => void
Click functionality, do any extra staff when clicking on the point, just create needed logic for click functionality
Parameters
extraProperties?: any
Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit . Equivalent to a normal string in usage and functionality.
import
imported from ol
import
imported from ol
import
imported from ol
import
imported from ol
import
imported from ol
Properties
Color of the marker, HEX or css compliant color value. Only use when a semantic status isn't working for the use-case.
color?: string
Icon options
icon?: IconMarkerOptions
Semantic status for coloring. This is also theme-aware.
status?: MarkerStatusType
Visual representation of marker
type: ("status" | "icon" | "dot")

import
imported from ol
import
imported from ol
Class for grouping functionality
Constructor
(groupColors: (Record<number, string> | ColorPalette) = 'status') => {}
Parameters
groupColors: (Record<number, string> | ColorPalette) = 'status'
Properties
_colors: string[]
_palette?: ColorPalette
Accessors
get colors: string[]
get length: number
get palette: (string | undefined)
Methods
(groupId: number) => string
Parameters
groupId: number
import
imported from ol
() => {}
Constructor

import
imported from ol
import
imported from ol
import
imported from ol
imported from ol
Properties
Scale value for marker
scale?: number
Path to the icon image
src?: string
("success" | "info" | "warning" | "danger" | "caution" | "critical" | "default" | "unknown")
import
imported from ol
import
imported from ol
import
imported from ol
import
imported from ol
import
imported from ol
() => {}
import
imported from ol
import
imported from ol
import
imported from ol
import
imported from ol
Properties
component?: Type<any>
map?: Map
mapPoints: (MapPointMetaData | MapPointMetaData[])
Constructor
() => {}
Properties
elementRef: ElementRef<any> = ...
hiddenEntries: WritableSignal<number> = ...
Adds the maximum length of a string thats allowed in a tooltip and if its longer it cuts off the rest and adds 3 dots at the end. If set to -1, it will not cut off the string.
maxLabelLength: InputSignal<number> = 50
Cutoff text for tooltips, when cluster combines more than 4 features
moreText: InputSignal<TranslatableString> = $localize`:@@SI_MAPS.TOOLTIP_MORE_TEXT:+ {{length}} locations`
tooltipLabels: WritableSignal<string[]> = ...
Accessors
get nativeElement: HTMLElement
Methods
Parameters
label: string
(labels: (string | string[])) => void
Method sets tooltip content. If parameter is of type string, it will directly set it as tooltip content. If it is array of string, it will render it as list of those strings.
Parameters
array of strings or string itself
labels: (string | string[])
Constructor
() => {}
Properties
_theme?: { colorPalette: ColorPalettes, defaultMarkerColor: string, fillColor: string, status: Record<MarkerStatusType, string>, strokeColor: string, textColor: string }
clusterStyleCache: Record<string, Style[]> = {}
grouping?: Grouping
labelStyleCache: Record<string, Style[]> = {}
labelTextStyleCache: Record<string, Text[]> = {}
styleCache: Record<string, Style[]> = {}
wrappedTextCache: Record<string, string> = {}
zoomCallback: () => (number | undefined) = ...
Accessors
get theme: { colorPalette: ColorPalettes, defaultMarkerColor: string, fillColor: string, status: Record<MarkerStatusType, string>, strokeColor: string, textColor: string }
Methods
(distance: number, clusterRadius: number) => number
Calculates minimal safe distance for clustering to avoid overlapping of clusters
Parameters
distance: number
clusterRadius: number
(features: Feature<Geometry, { [ x: string ]: any } }>[], markerAnimation: boolean, clusterDistance: number, multiWorld: boolean) => Layer
Initialize animated cluster layer for points if clustering is enabled
Parameters
for the source
features: Feature<Geometry, { [ x: string ]: any } }>[]
animation value for markers
markerAnimation: boolean
number distance between clusters
clusterDistance: number
boolean if points should be repeated on multiple world maps
multiWorld: boolean
(points: MapPoint[], alwaysShowLabels: boolean = false) => Feature<Geometry, { [ x: string ]: any } }>[]
Create feature with parameters
Parameters
the list of points
points: MapPoint[]
alwaysShowLabels: boolean = false
(features: Feature<Geometry, { [ x: string ]: any } }>[], grouping: Grouping) => ImageStyle
Parameters
features: Feature<Geometry, { [ x: string ]: any } }>[]
grouping: Grouping
(features: Feature<Geometry, { [ x: string ]: any } }>[], grouping: Grouping) => { colors: string[], data: number[] }
Parameters
features: Feature<Geometry, { [ x: string ]: any } }>[]
grouping: Grouping
(feature: Feature) => Style[]
Cluster styling
Parameters
Feature
feature: Feature
Parameters
color: string
(feature: Feature, cluster: boolean, features: Feature<Geometry, { [ x: string ]: any } }>[], dummy: boolean = false) => Style[]
Separate feature styling with icon
Parameters
to style
feature: Feature
indication
cluster: boolean
list of features
features: Feature<Geometry, { [ x: string ]: any } }>[]
dummy: boolean = false
(color: string, iconConf: IconMarkerOptions) => Icon
Parameters
color: string
iconConf?: IconMarkerOptions
(feature: Feature<Point>, features: Feature<Point, { [ x: string ]: any } }>[], maxLabelLength: number, maxLines: number, clusterSource: Cluster<Feature<Point, { [ x: string ]: any } }>>, dummy: boolean = false) => Style[]
Parameters
feature: Feature<Point>
features: Feature<Point, { [ x: string ]: any } }>[]
maxLabelLength: number
maxLines: number
clusterSource?: Cluster<Feature<Point, { [ x: string ]: any } }>>
dummy: boolean = false
(text: string = '', maxLength: number, maxLines: number, markerSizes: [ number, number ], markerOffset: [ number, number ]) => Text[]
Parameters
text: string = ''
maxLength: number
maxLines: number
markerSizes: [ number, number ]
markerOffset: [ number, number ]
(feature: Feature, grouping: Grouping, marker: MarkerOptions) => string
Decides what color should Marker be painted with.

Markers are painted with group colors if group id is present. If marker color is specified, it takes precedence over the group color.
Parameters
feature: Feature
grouping: Grouping
marker?: MarkerOptions
(feature: Feature) => [ number, number ]
Parameters
feature: Feature
(feature: Feature) => [ number, number ]
Parameters
feature: Feature
(feature: Feature, grouping: Grouping, marker: MarkerOptions) => (Icon | CircleStyle | undefined)
Parameters
feature: Feature
grouping: Grouping
marker?: MarkerOptions
Parameters
marker: MarkerOptions
(theme: { colorPalette: ColorPalettes, defaultMarkerColor: string, fillColor: string, status: Record<MarkerStatusType, string>, strokeColor: string, textColor: string }, marker: MarkerOptions) => (string | undefined)
Parameters
theme: { colorPalette: ColorPalettes, defaultMarkerColor: string, fillColor: string, status: Record<MarkerStatusType, string>, strokeColor: string, textColor: string }
marker?: MarkerOptions
getZoom: () => number
(features: Feature<Geometry, { [ x: string ]: any } }>[], multiWorld: boolean, maxLabelLength: number, maxLines: number, clusterLayer: Layer<Source, LayerRenderer<any>, { [ x: string ]: any } }>) => VectorLayer<VectorSource<Feature<Geometry, { [ x: string ]: any } }>>>
Parameters
features: Feature<Geometry, { [ x: string ]: any } }>[]
multiWorld: boolean
maxLabelLength: number
maxLines: number
clusterLayer?: Layer<Source, LayerRenderer<any>, { [ x: string ]: any } }>
resetCaches: () => void
Parameters
groupColors: (Record<number, string> | ColorPalette | undefined)
(callback: () => (number | undefined)) => void
Parameters
callback?: () => (number | undefined)
(data: number[], series: number[], size: number) => void
Parameters
data: number[]
series: number[]
size: number
(features: Feature<Geometry, { [ x: string ]: any } }>[], multiWorld: boolean, defaultStyle: boolean = false) => VectorLayer<VectorSource<Feature<Geometry, { [ x: string ]: any } }>>>
Create vector layer when clustering is disabled
Parameters
list of Features
features: Feature<Geometry, { [ x: string ]: any } }>[]
boolean if points should be repeated on multiple world maps
multiWorld: boolean
defaultStyle: boolean = false
(labelText: string, maxLength: number, maxLines: number) => string
Parameters
labelText: string
maxLength: number
maxLines: number
Constructor
() => {}
Properties
contentContainer: Signal<ViewContainerRef> = ...
defaultCluster: Signal<TemplateRef<any>> = ...
defaultContent: Signal<TemplateRef<any>> = ...
elementRef: Signal<ElementRef<any>> = ...
maxHeight: WritableSignal<(number | null)> = ...
Methods
Parameters
Parameter: RenderOptions
Parameters
component: Type<any>
mapPoints: (MapPointMetaData | MapPointMetaData[])
Parameters
mapPoints: (MapPointMetaData | MapPointMetaData[])
Wrapper around an actual translation framework which is meant to be used internally by Element. Applications must not use this service.

Use injectSiTranslateService to get an instance of the translation service.
Constructor
() => {}
Properties
The currently used language.
currentLanguage: (string | null)
documentRef: Document = ...
prevent$LocalizeInit?: boolean
translationChange$: Observable<void> = NEVER
Accessors
The available languages.
get availableLanguages: readonly string[]
set availableLanguages: (languages: string[])
If the underlying translation library supports switching the language and/or updating the translation texts, this observable will emit. There is no initial emit.
get translationChange: Observable<void>
Methods
The language to be used as default.
Returns The code of the default language.

getDefaultLanguage: () => (string | null)
Sets a new language to be used. If needed, loads the language file.
Returns An observable that emits when the new language is loaded and activated.
Parameters
The language to be used.
lang: string
The language to be used as default.
Parameters
The language code.
lang: string
Parameters
lang: string
(key: string, value: string) => void
If supported by the underlying translation library, this method can be used to add a translation for a specific key.
It is intended to be used for adding the english default value.
It will be called whenever a key within element is resolved.
An implementation of this method must check that it does not override an existing translation.
Parameters
key: string
value: string
<(T: (string | string[]))> (keys: T, params: Record<string, unknown>) => (TranslationResult<T> | Observable<TranslationResult<T>>)
Translates the key(s) by using the underlying translation library.
Returns Returns the translated key or an object with the translated keys. Depending on the underlying translation library (sync/async) the result will be wrapped in an Observable.
Parameters
A single translation key or an array of keys.
keys: T
Parameters to be replaced within the translation text.
params?: Record<string, unknown>
<(T: (string | string[]))> (keys: T, params: Record<string, unknown>) => Observable<TranslationResult<T>>
Translates the key(s) by using the underlying translation library in an asynchronous manner. It will emit each time the active language is changed.
Returns Returns the translated key or an object with the translated keys wrapped in an Observable.
Parameters
A single translation key or an array of keys.
keys: T
Parameters to be replaced within the translation text.
params?: Record<string, unknown>
<(T: (string | string[]))> (keys: T, params: Record<string, unknown>) => TranslationResult<T>
Translates the key(s) by using the underlying translation library in a synchronous manner.

Warning: The caller of this function needs to make sure the translation file(s) are already loaded. It is generally not recommended to use this function unless you know exactly what you are doing.

Returns Returns the translated key or an object with the translated keys.
Parameters
A single translation key or an array of keys.
keys: T
Parameters to be replaced within the translation text.
params?: Record<string, unknown>
Pass through implementation of the SiTranslateService which is used as a default.
Constructor
() => {} from SiTranslateService
Properties
lang: "en" = 'en'
prevent$LocalizeInit?: boolean from prevent$LocalizeInit
translationChange$: Observable<void> from translationChange$ = NEVER
Accessors
The available languages.
get availableLanguages: string[]
The available languages.
set availableLanguages: (lang: string[])
The currently used language.
-
The currently used language.

get currentLanguage: string
If the underlying translation library supports switching the language and/or updating the translation texts, this observable will emit. There is no initial emit.
get translationChange: Observable<void> from translationChange
Methods
The language to be used as default.
Returns The code of the default language.

getDefaultLanguage: () => string
Sets a new language to be used. If needed, loads the language file.
Returns An observable that emits when the new language is loaded and activated.
Parameters
The language to be used.
lang: string
The language to be used as default.
Parameters
The language code.
lang: string
Parameters
lang: string
If supported by the underlying translation library, this method can be used to add a translation for a specific key.
It is intended to be used for adding the english default value.
It will be called whenever a key within element is resolved.
An implementation of this method must check that it does not override an existing translation.
Parameters
key: string
value: string
<(T: (string | string[]))> (keys: T, _params: Record<string, unknown>) => TranslationResult<T>
Translates the key(s) by using the underlying translation library.
Returns Returns the translated key or an object with the translated keys. Depending on the underlying translation library (sync/async) the result will be wrapped in an Observable.
Parameters
A single translation key or an array of keys.
keys: T
_params?: Record<string, unknown>
<(T: (string | string[]))> (keys: T, params: Record<string, unknown>) => Observable<TranslationResult<T>>
Translates the key(s) by using the underlying translation library in an asynchronous manner. It will emit each time the active language is changed.
Returns Returns the translated key or an object with the translated keys wrapped in an Observable.
Parameters
A single translation key or an array of keys.
keys: T
Parameters to be replaced within the translation text.
params?: Record<string, unknown>
<(T: (string | string[]))> (keys: T, params: Record<string, unknown>) => TranslationResult<T>
Translates the key(s) by using the underlying translation library in a synchronous manner.

Warning: The caller of this function needs to make sure the translation file(s) are already loaded. It is generally not recommended to use this function unless you know exactly what you are doing.

Returns Returns the translated key or an object with the translated keys.
Parameters
A single translation key or an array of keys.
keys: T
Parameters to be replaced within the translation text.
params?: Record<string, unknown>

Except where otherwise noted, content on this site is licensed under MIT License.