關於 SAP Fiori Elements 應用標題屬性(title) 的複製邏輯單步除錯
阿新 • • 發佈:2021-06-16
為支援國際化(internationalization),title 屬性的值沒有硬編碼,而是維護在 i18n_<language_code>.properties 裡:
https://ldai7er9.wdf.sap.corp:44300/sap/bc/ui5_ui5/sap/jerryfioriapp/i18n/i18n_zh.properties
想要以中文環境載入 SAP UI5 應用,在 url 後面加上引數即可:
sap-ui-language=ZH
維護在 i18n_<language_code>.properties 裡的標題內容,為漢字的 unicode:
HTML header 對應的設定:meta content="text/html;charset=UTF-8":
SAP Fiori Elements 應用 index.html 裡 title 屬性的值:
<title>{{appTitle}}</title>
使用下列這行 JavaScript 程式碼,可以在 window.document title 屬性被修改時,讓斷點自動觸發:
Object.defineProperty(window.document, "title", { set: function(){ debugger;}});
從下圖可見,Fiori Elements 應用的 title 屬性,其值來自於 oMetadata.title:
再研究 metadata 是從哪裡解析的:
AppConfiguration.js:
答案是來自 manifest.json:
更多Jerry的原創文章,盡在:"汪子熙":