From 2271fd43b80418d291df547e06424bfca7fda2b8 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sun, 26 May 2024 16:21:04 +0200 Subject: [PATCH] First step toward implementing #549 --- ..._object_to_js_code_declaring_an_object.ftl | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl b/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl index 805f84e8..58d8ca09 100644 --- a/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +++ b/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl @@ -2,8 +2,6 @@ (()=>{ <#assign pageId="PAGE_ID_xIgLsPgGId9D8e"> const out = ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc}; -out["msg"]= function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); }; -out["advancedMsg"]= function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); }; out["messagesPerField"]= { <#assign fieldNames = [ FIELD_NAMES_eKsIY4ZsZ4xeM ]> <#attempt> @@ -181,6 +179,26 @@ try { out["url"]["resourcesCommonPath"] = out["url"]["resourcesPath"] + "/" + "RESOURCES_COMMON_cLsLsMrtDkpVv"; } catch(error) { } +<#if profile?? && profile.attributes??> + out["__localizationReamlOverrides_userProfile"] = { + <#list profile.attributes as attribute> + <#if attribute.annotations?? && attribute.displayName??> + "${attribute.displayName}xx": "${advancedMsg(attribute.displayName)?no_esc}", + + <#if attribute.annotations.inputHelperTextBefore??> + "${attribute.annotations.inputHelperTextBefore}": "${advancedMsg(attribute.annotations.inputHelperTextBefore)?no_esc}", + + <#if attribute.annotations.inputHelperTextAfter??> + "${attribute.annotations.inputHelperTextAfter}": "${advancedMsg(attribute.annotations.inputHelperTextAfter)?no_esc}", + + <#if attribute.annotations.inputTypePlaceholder??> + "${attribute.annotations.inputTypePlaceholder}": "${advancedMsg(attribute.annotations.inputTypePlaceholder)?no_esc}", + + + }; + + + return out; })();