@sap-ux/fe-fpm-writer 0.24.1 → 0.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,6 +62,7 @@ exports.getTemplateRoot = getTemplateRoot;
62
62
  * @returns {Promise<Editor>} the updated memfs editor instance
63
63
  */
64
64
  function generate(basePath, data, fs) {
65
+ var _a, _b, _c;
65
66
  if (!fs) {
66
67
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
67
68
  }
@@ -82,6 +83,18 @@ function generate(basePath, data, fs) {
82
83
  const viewPath = (0, path_1.join)(config.path, `${config.name}.view.xml`);
83
84
  if (!fs.exists(viewPath)) {
84
85
  fs.copyTpl((0, path_1.join)(root, 'ext/View.xml'), viewPath, config);
86
+ // i18n.properties
87
+ const manifest = fs.readJSON(manifestPath);
88
+ const defaultI18nPath = 'i18n/i18n.properties';
89
+ const customI18nPath = (_c = (_b = (_a = manifest === null || manifest === void 0 ? void 0 : manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.models) === null || _b === void 0 ? void 0 : _b.i18n) === null || _c === void 0 ? void 0 : _c.uri;
90
+ const i18nPath = (0, path_1.join)(basePath, 'webapp', customI18nPath !== null && customI18nPath !== void 0 ? customI18nPath : defaultI18nPath);
91
+ const i18TemplatePath = (0, path_1.join)(root, 'i18n', 'i18n.properties');
92
+ if (fs.exists(i18nPath)) {
93
+ fs.append(i18nPath, (0, ejs_1.render)(fs.read(i18TemplatePath), config, {}));
94
+ }
95
+ else {
96
+ fs.copyTpl(i18TemplatePath, i18nPath, config);
97
+ }
85
98
  }
86
99
  const ext = data.typescript ? 'ts' : 'js';
87
100
  const controllerPath = (0, path_1.join)(config.path, `${config.name}.controller.${ext}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fe-fpm-writer",
3
3
  "description": "SAP Fiori elements flexible programming model writer",
4
- "version": "0.24.1",
4
+ "version": "0.24.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -33,7 +33,7 @@
33
33
  "@types/mem-fs": "1.1.2",
34
34
  "@types/mem-fs-editor": "7.0.1",
35
35
  "@types/semver": "7.5.2",
36
- "@sap-ux/project-access": "1.15.1"
36
+ "@sap-ux/project-access": "1.15.4"
37
37
  },
38
38
  "engines": {
39
39
  "pnpm": ">=6.26.1 < 7.0.0 || >=7.1.0",
@@ -1,6 +1,6 @@
1
1
  <mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
2
2
  xmlns:html="http://www.w3.org/1999/xhtml" controllerName="<%- ns %>.<%- name %>">
3
- <Page id="<%- name %>">
3
+ <Page id="<%- name %>" title="{i18n><%- name %>Title}">
4
4
  <content></content>
5
5
  </Page>
6
6
  </mvc:View>
@@ -0,0 +1,2 @@
1
+ #XTIT: Custom view title
2
+ <%=name%>Title=<%=view.title%>
@@ -1,6 +1,6 @@
1
1
  <mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:macros="sap.fe.macros"
2
2
  xmlns:html="http://www.w3.org/1999/xhtml" controllerName="<%- ns %>.<%- name %>">
3
- <Page id="<%- name %>">
3
+ <Page id="<%- name %>" title="{i18n><%- name %>Title}">
4
4
  <content></content>
5
5
  </Page>
6
6
  </mvc:View>
@@ -0,0 +1,2 @@
1
+ #XTIT: Custom view title
2
+ <%=name%>Title=<%=view.title%>
@@ -0,0 +1,2 @@
1
+ #XTIT: Custom view title
2
+ <%=name%>Title=<%=view.title%>