From 3c826f21fc860c8edf4df19f90e307ed563781bd Mon Sep 17 00:00:00 2001 From: Marten Schiwek Date: Wed, 27 Nov 2024 09:26:16 +0100 Subject: [PATCH] Support for `@UI.HeaderInfo.TypeName` (#124) Hi colleagues, for the object type column the label of the entity is being used. However it is not common that entities are annoyed with a label. Instead they usually have the `@UI.HeaderInfo` annotation annotated as it dictates app, object page and table names in Fiori elements. Thus change tracking should also consider this annotation as a fallback. `@UI.HeaderInfo.TypeNamePlural` is also an option if desired. Moreover `@UI.HeaderInfo.Title` defines the object page identifier for a rotation and it might make sense to consider this for a nicer Object Key (or consider @Common.SemanticKey). BR, Marten Co-authored-by: Wenjun Zheng <86405404+Sv7enNowitzki@users.noreply.github.com> --- lib/localization.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/localization.js b/lib/localization.js index 2fd5b39..2eeee21 100644 --- a/lib/localization.js +++ b/lib/localization.js @@ -98,7 +98,7 @@ const _getLabelI18nKeyOnEntity = function (entityName, /** optinal */ attribute) let def = cds.model.definitions[entityName]; if (attribute) def = def?.elements[attribute] if (!def) return ""; - return def['@Common.Label'] || def['@title']; + return def['@Common.Label'] || def['@title'] || def['@UI.HeaderInfo.TypeName']; }; const localizeLogFields = function (data, locale) {