Skip to content

Commit 953630d

Browse files
authored
Allow @title for column Object Type (#26)
1 parent cbb535f commit 953630d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/localization.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const cds = require("@sap/cds/lib");
22
const LOG = cds.log("change-log");
33
const { getNameFromPathVal, getDBEntity } = require("./entity-helper");
44
const OBJECT_TYPE_I18N_LABEL_KEY = "@Common.Label"
5+
const OBJECT_TYPE_I18N_TITLE_KEY = "@title"
56

67
const MODIF_I18N_MAP = {
78
create: "{i18n>ChangeLog.modification.create}",
@@ -103,7 +104,8 @@ const _getLabelI18nKeyOnEntity = function (entityName, /** optinal */ attribute)
103104
const element = entity.elements[attribute] ? entity.elements[attribute] : {};
104105
return element[OBJECT_TYPE_I18N_LABEL_KEY];
105106
}
106-
return entity[OBJECT_TYPE_I18N_LABEL_KEY];
107+
const entityLabel = entity[OBJECT_TYPE_I18N_LABEL_KEY] ? entity[OBJECT_TYPE_I18N_LABEL_KEY] : entity[OBJECT_TYPE_I18N_TITLE_KEY];
108+
return entityLabel;
107109
};
108110

109111
const localizeLogFields = function (data, locale) {

0 commit comments

Comments
 (0)