Skip to content

Commit

Permalink
Allow @title for column Object Type (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnkiefer authored Oct 17, 2023
1 parent cbb535f commit 953630d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const cds = require("@sap/cds/lib");
const LOG = cds.log("change-log");
const { getNameFromPathVal, getDBEntity } = require("./entity-helper");
const OBJECT_TYPE_I18N_LABEL_KEY = "@Common.Label"
const OBJECT_TYPE_I18N_TITLE_KEY = "@title"

const MODIF_I18N_MAP = {
create: "{i18n>ChangeLog.modification.create}",
Expand Down Expand Up @@ -103,7 +104,8 @@ const _getLabelI18nKeyOnEntity = function (entityName, /** optinal */ attribute)
const element = entity.elements[attribute] ? entity.elements[attribute] : {};
return element[OBJECT_TYPE_I18N_LABEL_KEY];
}
return entity[OBJECT_TYPE_I18N_LABEL_KEY];
const entityLabel = entity[OBJECT_TYPE_I18N_LABEL_KEY] ? entity[OBJECT_TYPE_I18N_LABEL_KEY] : entity[OBJECT_TYPE_I18N_TITLE_KEY];
return entityLabel;
};

const localizeLogFields = function (data, locale) {
Expand Down

0 comments on commit 953630d

Please sign in to comment.