@openfin/workspace 17.2.0 → 17.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-api-platform/src/api/language.d.ts +13 -0
- package/client-api-platform/src/api/translation-override.d.ts +19 -0
- package/client-api-platform/src/init/index.d.ts +1 -1
- package/client-api-platform/src/init/override-callback/interop-override.d.ts +2 -0
- package/client-api-platform/src/shapes.d.ts +57 -0
- package/common/src/api/i18next.d.ts +7 -0
- package/common/src/api/overrides.d.ts +1 -0
- package/common/src/api/protocol/browser.d.ts +3 -1
- package/common/src/api/protocol/workspace-platform.d.ts +3 -0
- package/common/src/utils/global-context-menu.d.ts +1 -51
- package/common/src/utils/menu-config.d.ts +1 -0
- package/home.js +183 -131
- package/home.js.map +1 -1
- package/index.js +129 -77
- package/index.js.map +1 -1
- package/notifications.js +186 -134
- package/notifications.js.map +1 -1
- package/package.json +3 -1
- package/store.js +183 -131
- package/store.js.map +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Locale } from '../../../client-api-platform/src/shapes';
|
|
2
|
+
export declare function getLanguage(): Locale;
|
|
3
|
+
export declare const dispatchLanguageToBrowserWindows: (language: Locale) => Promise<void[]>;
|
|
4
|
+
export declare const setLanguage: (locale: Locale) => Promise<void>;
|
|
5
|
+
export declare function getLanguageResourcesInternal(): {
|
|
6
|
+
currentLanguage: "en-US" | "ja-JP" | "zh-CN" | "ko-KR" | "ru-RU" | "de-DE" | "zh-Hant";
|
|
7
|
+
resources: import("i18next/typescript/options").Resource;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* initLanguage()
|
|
11
|
+
* @param language - optional - ISO language code
|
|
12
|
+
*/
|
|
13
|
+
export default function initLanguage(language?: Locale): Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { i18next as i18n } from '../../../common/src/api/i18next';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a score for a version string depending on how specific it is. Higher == more specific.
|
|
4
|
+
* E.g. 16.x.0 gives a score of 101 whereas 16.5.0 returns 111
|
|
5
|
+
* @param versionString 3-fragment version string, e.g. 15.0.4, where fragments can be 'x' for generic templates
|
|
6
|
+
* @returns score from 0 to 111
|
|
7
|
+
*/
|
|
8
|
+
export declare const weighVersionString: (versionString: string) => number;
|
|
9
|
+
/**
|
|
10
|
+
* Returns array of versions from less specific to more specific
|
|
11
|
+
* @param matchingVersions versions and templates relevant to the running build
|
|
12
|
+
*/
|
|
13
|
+
export declare const getVersionsSortedByPriority: (matchingVersions: string[]) => string[];
|
|
14
|
+
/**
|
|
15
|
+
* Applies translation overrides to the i18next dictionary.
|
|
16
|
+
* In case of failure logs an error without preventing further execution.
|
|
17
|
+
* @param i18next i18next instance to which to apply the overrides
|
|
18
|
+
*/
|
|
19
|
+
export declare const applyTranslationOverrides: (i18next: typeof i18n) => Promise<void>;
|
|
@@ -34,4 +34,4 @@ import type { WorkspacePlatformInitConfig } from '../shapes';
|
|
|
34
34
|
* ```
|
|
35
35
|
* @param options options for configuring the platform.
|
|
36
36
|
*/
|
|
37
|
-
export declare const init: ({ theme, customActions, ...rest }: WorkspacePlatformInitConfig) => Promise<void>;
|
|
37
|
+
export declare const init: ({ theme, customActions, language, ...rest }: WorkspacePlatformInitConfig) => Promise<void>;
|
|
@@ -2,6 +2,7 @@ import type OpenFin from '@openfin/core';
|
|
|
2
2
|
import { IconProps } from '@openfin/ui-library';
|
|
3
3
|
import type { AnalyticsEvent, AnalyticsEventInternal } from '../../common/src/utils/usage-register';
|
|
4
4
|
import { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
|
|
5
|
+
import { Resource } from '../../common/src/api/i18next';
|
|
5
6
|
import type { AttachedPage, CopyPagePayload, HandleSaveModalOnPageClosePayload, Page, PageWithUpdatableRuntimeAttribs, SaveModalOnPageCloseResult } from '../../common/src/api/pages/shapes';
|
|
6
7
|
import { SetActivePageForWindowPayload } from '../../common/src/api/pages/shapes';
|
|
7
8
|
import { NotificationsCustomManifestOptions } from '../../common/src/api/shapes/notifications';
|
|
@@ -1414,6 +1415,39 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
|
|
|
1414
1415
|
* ```
|
|
1415
1416
|
*/
|
|
1416
1417
|
applyWorkspace(workspace: Workspace, options?: ApplyWorkspaceOptions): Promise<boolean>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Returns ISO language code of current set language
|
|
1420
|
+
*
|
|
1421
|
+
* @returns One of the seven ISO language codes Browser supports
|
|
1422
|
+
*
|
|
1423
|
+
* @example Example of how to get the current language on Browser
|
|
1424
|
+
*
|
|
1425
|
+
* ```ts
|
|
1426
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
1427
|
+
* WorkspacePlatform.getCurrentSync().getLanguage();
|
|
1428
|
+
* ```
|
|
1429
|
+
*/
|
|
1430
|
+
getLanguage(): Promise<Locale>;
|
|
1431
|
+
/**
|
|
1432
|
+
* Fetches currently selected language and language resources from platform provider.
|
|
1433
|
+
* @internal
|
|
1434
|
+
*/
|
|
1435
|
+
_getLanguageResources(): Promise<{
|
|
1436
|
+
currentLanguage: Locale;
|
|
1437
|
+
resources: Resource;
|
|
1438
|
+
}>;
|
|
1439
|
+
/**
|
|
1440
|
+
* Sets the language to ISO language code passed in
|
|
1441
|
+
* @param locale the ISO language code
|
|
1442
|
+
*
|
|
1443
|
+
* @example Example of how to set a different language on Browser
|
|
1444
|
+
*
|
|
1445
|
+
* ```ts
|
|
1446
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
1447
|
+
* WorkspacePlatform.getCurrentSync().setLanguage('zh-CN');
|
|
1448
|
+
* ```
|
|
1449
|
+
*/
|
|
1450
|
+
setLanguage(locale: Locale): Promise<void>;
|
|
1417
1451
|
/**
|
|
1418
1452
|
* Implementation for getting the notifications workspace platform configuration.
|
|
1419
1453
|
*/
|
|
@@ -1680,6 +1714,8 @@ export interface AnalyticsConfig {
|
|
|
1680
1714
|
*/
|
|
1681
1715
|
sendToOpenFin: boolean;
|
|
1682
1716
|
}
|
|
1717
|
+
export declare const SUPPORTED_LANGUAGES: readonly ["en-US", "ja-JP", "zh-CN", "ko-KR", "ru-RU", "de-DE", "zh-Hant"];
|
|
1718
|
+
export type Locale = (typeof SUPPORTED_LANGUAGES)[number];
|
|
1683
1719
|
/**
|
|
1684
1720
|
* Configuration for initializing a Workspace platform.
|
|
1685
1721
|
*/
|
|
@@ -1743,6 +1779,27 @@ export interface WorkspacePlatformInitConfig {
|
|
|
1743
1779
|
* ```
|
|
1744
1780
|
*/
|
|
1745
1781
|
theme?: CustomThemes;
|
|
1782
|
+
/**
|
|
1783
|
+
* Set a language on Browser by providing one of the seven languages that Workspace supports
|
|
1784
|
+
* Must specify one of the ISO language codes 'en-US', 'ja-JP', 'zh-CN', 'ko-KR', 'ru-RU', 'de-DE' or 'zh-Hant'
|
|
1785
|
+
*
|
|
1786
|
+
* @example
|
|
1787
|
+
* ```ts
|
|
1788
|
+
* await WorkspacePlatform.init({
|
|
1789
|
+
* browser: {
|
|
1790
|
+
* title: "My Browser"
|
|
1791
|
+
* },
|
|
1792
|
+
* language: {
|
|
1793
|
+
* initialLanguage: 'ru-RU'
|
|
1794
|
+
* }
|
|
1795
|
+
* });
|
|
1796
|
+
* ```
|
|
1797
|
+
* @default 'en-EN'
|
|
1798
|
+
*
|
|
1799
|
+
*/
|
|
1800
|
+
language?: {
|
|
1801
|
+
initialLanguage?: Locale;
|
|
1802
|
+
};
|
|
1746
1803
|
/**
|
|
1747
1804
|
* Override workspace platform behavior
|
|
1748
1805
|
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import i18next, { type Resource } from 'i18next';
|
|
2
|
+
import { Locale } from '../../../client-api-platform/src/shapes';
|
|
3
|
+
declare function initI18next(language?: Locale): void;
|
|
4
|
+
export declare const setLanguageInI18next: (locale: Locale) => void;
|
|
5
|
+
declare const t: import("i18next").TFunction<["translation", ...string[]], undefined>;
|
|
6
|
+
export { initI18next, i18next, t, type Resource };
|
|
7
|
+
export { useTranslation } from 'react-i18next';
|
|
@@ -17,6 +17,7 @@ export interface Overrides {
|
|
|
17
17
|
browserBaseUrl: string;
|
|
18
18
|
disableOpenFinAnalytics: boolean;
|
|
19
19
|
analyticsEndpoint: string;
|
|
20
|
+
translationOverridesUrl: string;
|
|
20
21
|
}
|
|
21
22
|
export declare function getOverrides(): Promise<Partial<Overrides>>;
|
|
22
23
|
export declare const useOverrides: () => Partial<Overrides>;
|
|
@@ -30,7 +30,8 @@ declare enum GeneralBrowserChannelActions {
|
|
|
30
30
|
OpenSaveModalInternal = "open-save-modal-internal",
|
|
31
31
|
DuplicatePage = "duplicate-page",
|
|
32
32
|
SetSelectedScheme = "set-selected-scheme",
|
|
33
|
-
ShowBrowserIndicator = "show-browser-indicator"
|
|
33
|
+
ShowBrowserIndicator = "show-browser-indicator",
|
|
34
|
+
SetSelectedLanguage = "set-selected-language"
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* All of the remote procedures that can be called in the
|
|
@@ -70,6 +71,7 @@ export declare const BrowserChannelAction: {
|
|
|
70
71
|
DuplicatePage: GeneralBrowserChannelActions.DuplicatePage;
|
|
71
72
|
SetSelectedScheme: GeneralBrowserChannelActions.SetSelectedScheme;
|
|
72
73
|
ShowBrowserIndicator: GeneralBrowserChannelActions.ShowBrowserIndicator;
|
|
74
|
+
SetSelectedLanguage: GeneralBrowserChannelActions.SetSelectedLanguage;
|
|
73
75
|
};
|
|
74
76
|
export type BrowserChannelAction = typeof BrowserChannelAction;
|
|
75
77
|
export {};
|
|
@@ -51,6 +51,9 @@ export declare enum WorkspacePlatformChannelAction {
|
|
|
51
51
|
SetActiveWorkspace = "setActiveWorkspace",
|
|
52
52
|
IsBrowserInitialized = "isBrowserInitialized",
|
|
53
53
|
Analytics = "analyticsInternal",
|
|
54
|
+
GetLanguage = "getLanguage",
|
|
55
|
+
GetLanguageResourcesInternal = "getLanguageResourcesInternal",
|
|
56
|
+
SetLanguage = "setLanguage",
|
|
54
57
|
GetDockProviderConfig = "getDockProviderConfig",
|
|
55
58
|
SaveDockProviderConfig = "saveDockProviderConfig",
|
|
56
59
|
HandleSaveModalOnPageClose = "handleSaveModalOnPageClose",
|
|
@@ -1,54 +1,4 @@
|
|
|
1
1
|
import type OpenFin from '@openfin/core';
|
|
2
|
-
import {
|
|
3
|
-
import * as WP from '../../../client-api-platform/src/index';
|
|
4
|
-
import { GlobalContextMenuItemTemplate, GlobalContextMenuOptionType, Workspace } from '../../../client-api-platform/src/shapes';
|
|
2
|
+
import { GlobalContextMenuItemTemplate } from '../../../client-api-platform/src/shapes';
|
|
5
3
|
export declare const isOSWindows: () => Promise<boolean>;
|
|
6
|
-
export declare const savePage: {
|
|
7
|
-
type: MenuItemType;
|
|
8
|
-
label: string;
|
|
9
|
-
data: {
|
|
10
|
-
type: WP.GlobalContextMenuOptionType;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export declare const savePageAs: {
|
|
14
|
-
type: MenuItemType;
|
|
15
|
-
label: string;
|
|
16
|
-
data: {
|
|
17
|
-
type: WP.GlobalContextMenuOptionType;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare const saveWorkspace: {
|
|
21
|
-
type: MenuItemType;
|
|
22
|
-
label: string;
|
|
23
|
-
data: {
|
|
24
|
-
type: WP.GlobalContextMenuOptionType;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export declare const saveWorkspaceAs: {
|
|
28
|
-
type: MenuItemType;
|
|
29
|
-
label: string;
|
|
30
|
-
data: {
|
|
31
|
-
type: WP.GlobalContextMenuOptionType;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export declare const printMenuOptions: (isViewSelected: boolean) => Promise<GlobalContextMenuItemTemplate>;
|
|
35
|
-
export declare const getSavedWorkspaceContextMenuOptions: (activeWorkspace: Workspace, savedWorkspaces: Workspace[], contextMenuOptionType: GlobalContextMenuOptionType) => {
|
|
36
|
-
label: string;
|
|
37
|
-
type: MenuItemType;
|
|
38
|
-
enabled: boolean;
|
|
39
|
-
checked: boolean;
|
|
40
|
-
data: {
|
|
41
|
-
type: WP.GlobalContextMenuOptionType;
|
|
42
|
-
workspaceId: string;
|
|
43
|
-
};
|
|
44
|
-
}[];
|
|
45
|
-
export declare const getAppearanceContextMenuOptions: () => Promise<{
|
|
46
|
-
label: string;
|
|
47
|
-
type: MenuItemType;
|
|
48
|
-
checked: boolean;
|
|
49
|
-
data: {
|
|
50
|
-
type: WP.GlobalContextMenuOptionType;
|
|
51
|
-
scheme: WP.ColorSchemeOptionType;
|
|
52
|
-
};
|
|
53
|
-
}[]>;
|
|
54
4
|
export declare const getGlobalContextMenuTemplate: (winIdentity: OpenFin.Identity, selectedViews?: OpenFin.Identity[]) => Promise<GlobalContextMenuItemTemplate[]>;
|