Skip to content

Commit

Permalink
Added everything for Step 9: Formatting Values
Browse files Browse the repository at this point in the history
  • Loading branch information
wridgeu committed May 20, 2020
1 parent 554f7ad commit d077849
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
5 changes: 5 additions & 0 deletions webapp/i18n/i18n.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ address=Address
# Screen titles
panel1HeaderText=Data Binding Basics
panel2HeaderText=Address Details

# E-mail
sendEmail=Send Mail
mailSubject=Hi {0}!
mailBody=How are you?
7 changes: 6 additions & 1 deletion webapp/i18n/i18n_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ enabled=Aktiviert

# Screen titles
panel1HeaderText=Data Binding Grundlagen
panel2HeaderText=Adressdetails
panel2HeaderText=Adressdetails

# E-mail
sendEmail=E-mail versenden
mailSubject=Hallo {0}!
mailBody=Wie geht es dir?
7 changes: 6 additions & 1 deletion webapp/i18n/i18n_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ address=Address

# Screen titles
panel1HeaderText=Data Binding Basics
panel2HeaderText=Address Details
panel2HeaderText=Address Details

# E-mail
sendEmail=Send Mail
mailSubject=Hi {0}!
mailBody=How are you?
14 changes: 12 additions & 2 deletions webapp/model/formatter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
sap.ui.define([], function () {
sap.ui.define([
"sap/m/library"
], function (mobileLibrary) {
"use strict";
return {};
return {
formatMail: function(sFirstName, sLastName) {
var oBundle = this.getOwnerComponent().getModel("i18n").getResourceBundle();
return mobileLibrary.URLHelper.normalizeEmail(
sFirstName + "." + sLastName + "@example.com",
oBundle.getText("mailSubject", [sFirstName]),
oBundle.getText("mailBody"));
}
};
});
9 changes: 9 additions & 0 deletions webapp/view/Home.view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
<l:VerticalLayout>
<Label class="sapUiSmallMargin" text="{i18n>address}:"/>
<FormattedText class="sapUiSmallMarginBegin sapUiSmallMarginBottom" htmlText="{/address/street}&lt;br&gt;{/address/zip} {/address/city}&lt;br&gt;{/address/country}" width="200px"/>
<Link class="sapUiSmallMarginBegin"
href="{
parts: [
'/firstName',
'/lastName'
],
formatter: '.formatter.formatMail'
}"
text="{i18n>sendEmail}"/>
</l:VerticalLayout>
</content>
</Panel>
Expand Down

0 comments on commit d077849

Please sign in to comment.