UNPKG

@itwin/core-common

Version:

iTwin.js components common to frontend and backend

32 lines 1.5 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Localization */ /** An empty [[Localization]] used if one is not provided to [IModelApp]($frontend). Does not perform localizations (merely returns the key.) * @public */ export class EmptyLocalization { async initialize() { } getLocalizedString(key) { if (typeof (key) !== "string") { key = key[0]; } // Simulate correct and simple usage of i18next's translation function // Namely, remove the leading namespace substring if there is one // Note: if there are no colons, split will return an array with a single element, which is the // key itself. So pop()! is safe. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion return key.split(":", 2).pop(); } getEnglishString(_namespace, key) { return this.getLocalizedString(key); } getLocalizedKeys(inputString) { return inputString; } async registerNamespace() { } unregisterNamespace() { } getNamespacePromise() { return undefined; } getLanguageList() { return []; } async changeLanguage() { } } //# sourceMappingURL=Localization.js.map