From 73246ec065e18ab354c307aeff6b326ef0c9899c Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 25 Nov 2023 16:59:06 +0100 Subject: [PATCH] frontend-plugin-api: re-export translation APIs Signed-off-by: Patrik Oldsberg --- .changeset/six-cooks-attack.md | 5 ++++ packages/frontend-plugin-api/api-report.md | 28 +++++++++++++++++++ .../extensions/createTranslationExtension.ts | 5 +--- packages/frontend-plugin-api/src/index.ts | 1 + .../src/translation/index.ts | 28 +++++++++++++++++++ 5 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 .changeset/six-cooks-attack.md create mode 100644 packages/frontend-plugin-api/src/translation/index.ts diff --git a/.changeset/six-cooks-attack.md b/.changeset/six-cooks-attack.md new file mode 100644 index 0000000000..0182f1e06a --- /dev/null +++ b/.changeset/six-cooks-attack.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-plugin-api': patch +--- + +Added translation APIs as well as `createTranslationExtension`. diff --git a/packages/frontend-plugin-api/api-report.md b/packages/frontend-plugin-api/api-report.md index c5b586615f..52445923fe 100644 --- a/packages/frontend-plugin-api/api-report.md +++ b/packages/frontend-plugin-api/api-report.md @@ -31,6 +31,9 @@ import { ConfigApi } from '@backstage/core-plugin-api'; import { configApiRef } from '@backstage/core-plugin-api'; import { createApiFactory } from '@backstage/core-plugin-api'; import { createApiRef } from '@backstage/core-plugin-api'; +import { createTranslationMessages } from '@backstage/core-plugin-api/alpha'; +import { createTranslationRef } from '@backstage/core-plugin-api/alpha'; +import { createTranslationResource } from '@backstage/core-plugin-api/alpha'; import { DiscoveryApi } from '@backstage/core-plugin-api'; import { discoveryApiRef } from '@backstage/core-plugin-api'; import { ErrorApi } from '@backstage/core-plugin-api'; @@ -75,10 +78,15 @@ import { StorageApi } from '@backstage/core-plugin-api'; import { storageApiRef } from '@backstage/core-plugin-api'; import { StorageValueSnapshot } from '@backstage/core-plugin-api'; import { TranslationMessages } from '@backstage/core-plugin-api/alpha'; +import { TranslationMessagesOptions } from '@backstage/core-plugin-api/alpha'; +import { TranslationRef } from '@backstage/core-plugin-api/alpha'; +import { TranslationRefOptions } from '@backstage/core-plugin-api/alpha'; import { TranslationResource } from '@backstage/core-plugin-api/alpha'; +import { TranslationResourceOptions } from '@backstage/core-plugin-api/alpha'; import { TypesToApiRefs } from '@backstage/core-plugin-api'; import { useApi } from '@backstage/core-plugin-api'; import { useApiHolder } from '@backstage/core-plugin-api'; +import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; import { withApis } from '@backstage/core-plugin-api'; import { z } from 'zod'; import { ZodSchema } from 'zod'; @@ -652,6 +660,12 @@ export namespace createTranslationExtension { >; } +export { createTranslationMessages }; + +export { createTranslationRef }; + +export { createTranslationResource }; + export { DiscoveryApi }; export { discoveryApiRef }; @@ -969,6 +983,18 @@ export interface SubRouteRef< readonly T: TParams; } +export { TranslationMessages }; + +export { TranslationMessagesOptions }; + +export { TranslationRef }; + +export { TranslationRefOptions }; + +export { TranslationResource }; + +export { TranslationResourceOptions }; + export { TypesToApiRefs }; // @public @@ -996,5 +1022,7 @@ export function useRouteRefParams( _routeRef: RouteRef | SubRouteRef, ): Params; +export { useTranslationRef }; + export { withApis }; ``` diff --git a/packages/frontend-plugin-api/src/extensions/createTranslationExtension.ts b/packages/frontend-plugin-api/src/extensions/createTranslationExtension.ts index b120a15c8d..59cc87948f 100644 --- a/packages/frontend-plugin-api/src/extensions/createTranslationExtension.ts +++ b/packages/frontend-plugin-api/src/extensions/createTranslationExtension.ts @@ -14,11 +14,8 @@ * limitations under the License. */ +import { TranslationMessages, TranslationResource } from '../translation'; import { createExtension, createExtensionDataRef } from '../wiring'; -import { - TranslationResource, - TranslationMessages, -} from '@backstage/core-plugin-api/alpha'; /** @public */ export function createTranslationExtension(options: { diff --git a/packages/frontend-plugin-api/src/index.ts b/packages/frontend-plugin-api/src/index.ts index a38a7991fb..ca3b291d64 100644 --- a/packages/frontend-plugin-api/src/index.ts +++ b/packages/frontend-plugin-api/src/index.ts @@ -28,6 +28,7 @@ export * from './icons'; export * from './routing'; export * from './schema'; export * from './apis/system'; +export * from './translation'; export * from './wiring'; export type { diff --git a/packages/frontend-plugin-api/src/translation/index.ts b/packages/frontend-plugin-api/src/translation/index.ts new file mode 100644 index 0000000000..ef3ccccbe3 --- /dev/null +++ b/packages/frontend-plugin-api/src/translation/index.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { + type TranslationMessages, + type TranslationMessagesOptions, + type TranslationResource, + type TranslationResourceOptions, + type TranslationRef, + type TranslationRefOptions, + createTranslationMessages, + createTranslationResource, + createTranslationRef, + useTranslationRef, +} from '@backstage/core-plugin-api/alpha';