Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
matz3 committed Dec 18, 2020
1 parent 7bfa12f commit 2a4bb8e
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions lib/processors/bundlers/manifestBundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,37 +79,35 @@ module.exports = ({resources, options: {namespace, bundleName, propertiesExtensi

const content = JSON.parse(manifest.content);
const appI18n = content["sap.app"]["i18n"];
let i18nFullPath;
let bundleUrl;
// i18n section in sap.app can be either a string or an object with bundleUrl
if (typeof appI18n === "object") {
if (appI18n.bundleUrl) {
i18nFullPath = appI18n.bundleUrl;
bundleUrl = appI18n.bundleUrl;
} else if (appI18n.bundleName) {
i18nFullPath = bundleNameToUrl(appI18n.bundleName, content["sap.app"]["id"]);
bundleUrl = bundleNameToUrl(appI18n.bundleName, content["sap.app"]["id"]);
}
} else if (typeof appI18n === "string") {
i18nFullPath = appI18n;
bundleUrl = appI18n;
} else {
i18nFullPath = "i18n/i18n.properties";
bundleUrl = "i18n/i18n.properties";
}
if (i18nFullPath) {
addI18nInfo(i18nFullPath);
if (bundleUrl) {
addI18nInfo(bundleUrl);
}

if (typeof appI18n === "object") {
if (Array.isArray(appI18n.enhanceWith)) {
appI18n.enhanceWith.forEach((enhanceWithEntry) => {
let bundleUrl;
if (enhanceWithEntry.bundleUrl) {
bundleUrl = enhanceWithEntry.bundleUrl;
} else if (enhanceWithEntry.bundleName) {
bundleUrl = bundleNameToUrl(enhanceWithEntry.bundleName, content["sap.app"]["id"]);
}
if (bundleUrl) {
addI18nInfo(bundleUrl);
}
});
}
if (typeof appI18n === "object" && Array.isArray(appI18n.enhanceWith)) {
appI18n.enhanceWith.forEach((enhanceWithEntry) => {
let bundleUrl;
if (enhanceWithEntry.bundleUrl) {
bundleUrl = enhanceWithEntry.bundleUrl;
} else if (enhanceWithEntry.bundleName) {
bundleUrl = bundleNameToUrl(enhanceWithEntry.bundleName, content["sap.app"]["id"]);
}
if (bundleUrl) {
addI18nInfo(bundleUrl);
}
});
}
}

Expand Down

0 comments on commit 2a4bb8e

Please sign in to comment.