Skip to content

Commit

Permalink
Update Component.js
Browse files Browse the repository at this point in the history
make plugin use i18n texts for button and message toast in me area
  • Loading branch information
tobiashofmann authored Feb 28, 2023
1 parent fbbe05a commit 670914e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions generators/newwebapp/templates/uimodule/webapp/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ sap.ui.define([

init: function () {
var rendererPromise = this._getRenderer();
var oResourceBundle = this.getModel("i18n").getResourceBundle();

// This is example code. Please replace with your implementation!
<% if (features.includes("Add button to launchpad header")) { %>
Expand Down Expand Up @@ -52,12 +53,13 @@ sap.ui.define([
* The first button is only visible if the Home page of SAP Fiori launchpad is open.
*/
rendererPromise.then(function (oRenderer) {
var _oResourceBundle = oResourceBundle;
oRenderer.addActionButton("sap.m.Button", {
id: "myHomeButton",
icon: "sap-icon://sys-help-2",
text: "Help for FLP page",
text: oResourceBundle.getText("buttonText"),
press: function () {
MessageToast.show("You pressed the button that opens a help page.");
MessageToast.show(_oResourceBundle.getText("msgMeAreaText"));
}
}, true, false, [sap.ushell.renderers.fiori2.RendererExtensions.LaunchpadState.Home]);

Expand All @@ -67,12 +69,12 @@ sap.ui.define([
oRenderer.addActionButton("sap.m.Button", {
id: "myAppButton",
icon: "sap-icon://sys-help",
text: "Help for App page",
text: oResourceBundle.getText("buttonText"),
press: function () {
MessageToast.show("You pressed the button that opens a help for apps page.");
MessageToast.show(_oResourceBundle.getText("msgMeAreaTextApp"));
}
}, true, false, [sap.ushell.renderers.fiori2.RendererExtensions.LaunchpadState.App]);
});
}.bind(this));
<% } %>
},

Expand Down

0 comments on commit 670914e

Please sign in to comment.