Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/ai/src/Button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js";
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import { i18n } from "@ui5/webcomponents-base/dist/decorators.js";
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
import query from "@ui5/webcomponents-base/dist/decorators/query.js";
Expand All @@ -17,12 +18,11 @@ import {
getAssociatedLabelForTexts,
getAllAccessibleNameRefTexts,
} from "@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js";
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
import type { AccessibilityAttributes } from "@ui5/webcomponents-base/dist/types.js";

// Styles
import ButtonCss from "./generated/themes/Button.css.js";
import { i18n } from "@ui5/webcomponents-base/dist/decorators.js";
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
import type { AccessibilityAttributes } from "@ui5/webcomponents-base/dist/types.js";

type AIButtonRootAccessibilityAttributes = Pick<AccessibilityAttributes, "hasPopup" | "roleDescription" | "title" | "ariaKeyShortcuts">;
type AIButtonArrowButtonAccessibilityAttributes = Pick<AccessibilityAttributes, "hasPopup" | "expanded" | "title">;
Expand Down Expand Up @@ -190,8 +190,8 @@ class Button extends UI5Element {
@query(".ui5-ai-button-hidden[ui5-split-button]")
_hiddenSplitButton?: SplitButton;

@i18n("@ui5/webcomponents")
static i18nBundle: I18nBundle;
@i18n("@ui5/webcomponents-ai")
static i18nBundleAi: I18nBundle;

get _hideArrowButton() {
return !this._effectiveStateObject?.showArrowButton;
Expand Down Expand Up @@ -352,7 +352,7 @@ class Button extends UI5Element {
get _computedAccessibilityAttributes(): AIButtonAccessibilityAttributes {
const labelRefTexts = getAllAccessibleNameRefTexts(this) || getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || "";

const mainTitle = this._hasText ? Button.i18nBundle.getText(BUTTON_TOOLTIP_TEXT, this._stateText as string) : "";
const mainTitle = this._hasText ? Button.i18nBundleAi.getText(BUTTON_TOOLTIP_TEXT, this._stateText as string) : "";
const title = `${mainTitle} ${labelRefTexts}`.trim();

return {
Expand Down
25 changes: 11 additions & 14 deletions packages/ai/src/WritingAssistant.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
import { i18n } from "@ui5/webcomponents-base/dist/decorators.js";
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
import announce from "@ui5/webcomponents-base/dist/util/InvisibleMessage.js";
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
import {
WRITING_ASSISTANT_LABEL,
Expand Down Expand Up @@ -113,12 +113,6 @@ class WritingAssistant extends UI5Element {
@property({ type: Boolean })
loading = false;

static i18nBundle: I18nBundle;

static async onDefine() {
WritingAssistant.i18nBundle = await getI18nBundle("@ui5/webcomponents-ai");
}

/**
* Defines the action text of the AI Writing Assistant.
*
Expand Down Expand Up @@ -158,6 +152,9 @@ class WritingAssistant extends UI5Element {
@property({ type: Number })
totalVersions = 1;

@i18n("@ui5/webcomponents-ai")
static i18nBundleAi: I18nBundle;

/**
* Handles the version change event from the versioning component.
*/
Expand All @@ -177,31 +174,31 @@ class WritingAssistant extends UI5Element {
this.fireDecoratorEvent("stop-generation");
} else {
this.fireDecoratorEvent("button-click", { clickTarget: target });
announce(WritingAssistant.i18nBundle.getText(WRITING_ASSISTANT_GENERATING_ANNOUNCEMENT), "Polite");
announce(WritingAssistant.i18nBundleAi.getText(WRITING_ASSISTANT_GENERATING_ANNOUNCEMENT), "Polite");
}
}
get _ariaLabel() {
return WritingAssistant.i18nBundle.getText(WRITING_ASSISTANT_LABEL);
return WritingAssistant.i18nBundleAi.getText(WRITING_ASSISTANT_LABEL);
}

get _previousButtonAccessibleName() {
return WritingAssistant.i18nBundle.getText(VERSIONING_PREVIOUS_BUTTON_TEXT);
return WritingAssistant.i18nBundleAi.getText(VERSIONING_PREVIOUS_BUTTON_TEXT);
}

get _nextButtonAccessibleName() {
return WritingAssistant.i18nBundle.getText(VERSIONING_NEXT_BUTTON_TEXT);
return WritingAssistant.i18nBundleAi.getText(VERSIONING_NEXT_BUTTON_TEXT);
}

get _toolbarAccessibleName() {
return WritingAssistant.i18nBundle.getText(WRITING_ASSISTANT_TOOLBAR_ACCESSIBLE_NAME);
return WritingAssistant.i18nBundleAi.getText(WRITING_ASSISTANT_TOOLBAR_ACCESSIBLE_NAME);
}

get _buttonAccessibleName() {
return WritingAssistant.i18nBundle.getText(WRITING_ASSISTANT_BUTTON_ACCESSIBLE_NAME);
return WritingAssistant.i18nBundleAi.getText(WRITING_ASSISTANT_BUTTON_ACCESSIBLE_NAME);
}

get _buttonTooltip() {
return WritingAssistant.i18nBundle.getText(WRITING_ASSISTANT_BUTTON_TOOLTIP);
return WritingAssistant.i18nBundleAi.getText(WRITING_ASSISTANT_BUTTON_TOOLTIP);
}
}

Expand Down
7 changes: 6 additions & 1 deletion packages/fiori/src/NavigationMenu.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
import {
isDesktop,
Expand Down Expand Up @@ -54,6 +56,9 @@ class NavigationMenu extends Menu {
@slot({ "default": true, type: HTMLElement, invalidateOnChildChange: true })
declare items: Array<NavigationMenuItem>;

@i18n("@ui5/webcomponents-fiori")
static i18nBundleFiori: I18nBundle;

_itemMouseOver(e: MouseEvent) {
if (isDesktop()) {
// respect mouseover only on desktop
Expand All @@ -65,7 +70,7 @@ class NavigationMenu extends Menu {
}

get accSideNavigationPopoverHiddenText() {
return NavigationMenu.i18nBundle.getText(NAVIGATION_MENU_POPOVER_HIDDEN_TEXT);
return NavigationMenu.i18nBundleFiori.getText(NAVIGATION_MENU_POPOVER_HIDDEN_TEXT);
}
}

Expand Down
8 changes: 6 additions & 2 deletions packages/fiori/src/NavigationMenuItem.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
import type { ClassMap } from "@ui5/webcomponents-base/dist/types.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import MenuItem from "@ui5/webcomponents/dist/MenuItem.js";
import type SideNavigationItemDesign from "./types/SideNavigationItemDesign.js";
import NavigationMenu from "./NavigationMenu.js";
import {
isSpace,
isEnter,
Expand Down Expand Up @@ -87,6 +88,9 @@ class NavigationMenuItem extends MenuItem {
@property()
design: `${SideNavigationItemDesign}` = "Default";

@i18n("@ui5/webcomponents-fiori")
static i18nBundleFiori: I18nBundle;

associatedItem?: SideNavigationSelectableItemBase;

get isExternalLink() {
Expand Down Expand Up @@ -201,7 +205,7 @@ class NavigationMenuItem extends MenuItem {
}

get acessibleNameText() {
return NavigationMenu.i18nBundle.getText(NAVIGATION_MENU_POPOVER_HIDDEN_TEXT);
return NavigationMenuItem.i18nBundleFiori.getText(NAVIGATION_MENU_POPOVER_HIDDEN_TEXT);
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/fiori/src/TimelineItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ class TimelineItem extends UI5Element implements ITimelineItem {
@property({ type: Number })
positionInGroup?: number;

@i18n("@ui5/webcomponents")
static i18nBundle: I18nBundle;
@i18n("@ui5/webcomponents-fiori")
static i18nBundleFiori: I18nBundle;

constructor() {
super();
Expand All @@ -206,7 +206,7 @@ class TimelineItem extends UI5Element implements ITimelineItem {
}

get timelineItemStateText() {
return this.state !== "None" ? TimelineItem.i18nBundle.getText(TimelineItem.typeTextMappings()[this.state]) : undefined;
return this.state !== "None" ? TimelineItem.i18nBundleFiori.getText(TimelineItem.typeTextMappings()[this.state]) : undefined;
}

get isGroupItem() {
Expand Down
Loading