Defined under the namespace Scandit.Datacapture.Core.Ui

class Localization

Added in version 6.21.0

The Localization class handles translations accross the SDK. Use it to get or update all the texts appearing in the UI.

static getInstance(): Localization

Added in version 6.21.0

Get the Localization singleton.

get<K>(key: keyof K): string

Added in version 6.21.0

Get a translation by key. If you use TypeScript, you can pass a generic to this method to get autocompletion from your editor:

// Using Core and Barcode modules:
Localization.getInstance().get<SDCCore.Translations | SDCBarcode.Translations>("core.camera.recovery");

If you use JavaScript, you can inspect all the keys by calling getAll().

getAll<K extends object>(): Record<DistributiveKeyOf<K>, string>

Added in version 6.21.0

Get all current translations. If you call this method before initializing a data capture loader (for example Id.idCaptureLoader()), the returned object might not contain the entries for this loader.

update<K extends object>(translations: Partial<Record<DistributiveKeyOf<K>, string>>): void

Added in version 6.21.0

Update the translations with the passed ones. You can pass all or a subset of the translations. Note that the translations set by this method will not be overwritten by the SDK default translations, even if the default translations are set at a later point in time.


Update the translations as soon as possible, ideally before calling configure(). Any update done after the creation of the entity using the related translation will not be taken into account.

This is an example on how to update a single translation using TypeScript:

// Update a translation of the Core module:
Localization.getInstance().update<SDCCore.Translations>({ "core.view.loading": "please wait..." });