Skip to content

Commit

Permalink
Merge pull request #4 from tobiashofmann/master
Browse files Browse the repository at this point in the history
Use i18n for texts in Me Area version
  • Loading branch information
wridgeu authored Mar 10, 2023
2 parents fe6874d + 3fdb640 commit fcac5da
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 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
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
pluginTitle=<%=projectname%>
pluginDescription=<%=projectname%>
pluginDescription=<%=projectname%>
buttonText=Help for FLP page
msgMeAreaText=You pressed the button that opens a help page.
msgMeAreaTextApp=You pressed the button that opens a help for apps page.
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
pluginTitle=<%=projectname%>
pluginDescription=<%=projectname%>
pluginDescription=<%=projectname%>
buttonText=Help for FLP page
msgMeAreaText=You pressed the button that opens a help page.
msgMeAreaTextApp=You pressed the button that opens a help for apps page.
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
pluginTitle=<%=projectname%>
pluginDescription=<%=projectname%>
pluginDescription=<%=projectname%>
buttonText=Help for FLP page
msgMeAreaText=You pressed the button that opens a help page.
msgMeAreaTextApp=You pressed the button that opens a help for apps page.
10 changes: 9 additions & 1 deletion generators/newwebapp/templates/uimodule/webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
"compact": true,
"cozy": false
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "<%=appId%>.i18n.i18n"
}
}
},
"dependencies": {
"minUI5Version": "1.38.1",
"libs": {
Expand All @@ -56,4 +64,4 @@
"type": "plugin",
"config": {}
}
}
}

0 comments on commit fcac5da

Please sign in to comment.