diff --git a/lib/processors/manifestCreator.js b/lib/processors/manifestCreator.js
index 411336dca..4e81d61ef 100644
--- a/lib/processors/manifestCreator.js
+++ b/lib/processors/manifestCreator.js
@@ -347,10 +347,9 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
return osComponents.length > 0 ? osComponents : undefined;
}
- const i18nAppData = findChild(manifestAppData, "i18n");
+ const i18nText = getChildTextContent(manifestAppData, "i18n");
let i18n;
- if (i18nAppData) {
- const i18nText = i18nAppData._; // text content
+ if (typeof i18nText === "string") {
i18n = createI18nSection(i18nText, i18nToSupportedLocales);
log.verbose(`sap.app/i18n taken from .library appData: '%s'`, i18nText);
}
@@ -487,10 +486,8 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
// - from .library/appData/manifest/sap.ui5/library/i18n
// - from library resources (if "messagebundle.properties" exists)
function i18n() {
- const i18nElement = findChild(libraryAppData, "i18n");
- let i18n = null;
- if ( i18nElement ) {
- i18n = i18nElement._; // text content
+ let i18n = getChildTextContent(libraryAppData, "i18n");
+ if ( typeof i18n === "string") {
if ( i18n === "false" ) {
return false;
} else if ( i18n === "true" ) {
@@ -505,6 +502,9 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
return false;
}
}
+ if (i18n === undefined) {
+ return false;
+ }
return createI18nSection(i18n, i18nToSupportedLocales);
}
@@ -568,8 +568,8 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
* null
if given i18n String is null
*/
function createI18nSection(i18n, i18nToSupportedLocales) {
- if (!i18n) {
- return null;
+ if (i18n === undefined) {
+ return undefined;
}
if (!i18n.endsWith(".properties")) {
return i18n;
diff --git a/test/lib/processors/manifestCreator.js b/test/lib/processors/manifestCreator.js
index 5d1ac313e..e30011fab 100644
--- a/test/lib/processors/manifestCreator.js
+++ b/test/lib/processors/manifestCreator.js
@@ -137,6 +137,52 @@ test.serial("default manifest creation", async (t) => {
t.is(await result.getString(), expectedManifestContent, "Correct result returned");
});
+test.serial("default manifest creation i18n empty string", async (t) => {
+ const {manifestCreator, errorLogStub} = t.context;
+ const prefix = "/resources/sap/ui/mine/";
+ const libraryResource = {
+ getPath: () => {
+ return prefix + ".library";
+ },
+ getString: async () => {
+ return `
+
+ library.e
+ SAP SE
+ my copyright
+ 1.0.0
+ Library E
+
+
+
+ sap.ui.core
+
+
+
+
+
+
+
+
+ `;
+ },
+ _project: {
+ dependencies: [{
+ metadata: {
+ name: "sap.ui.core"
+ }
+ }]
+ }
+ };
+
+ t.is(errorLogStub.callCount, 0);
+ const expectedManifestContentObjectModified = expectedManifestContentObject();
+ expectedManifestContentObjectModified["sap.app"]["i18n"] = "";
+ const expectedManifestContent = JSON.stringify(expectedManifestContentObjectModified, null, 2);
+ const result = await manifestCreator({libraryResource, resources: [], options: {}});
+ t.is(await result.getString(), expectedManifestContent, "Correct result returned");
+});
+
test.serial("default manifest creation with special characters", async (t) => {
const {manifestCreator, errorLogStub} = t.context;
const prefix = "/resources/sap/ui/mine/";