MockTag.getLocalizedTitle(Locale) and MockTag.getTitle(Locale) do not return valid value

Description

AEM provides the ability to localize tags values for different countries and languages, in Touch UI using page:

http://localhost:4502/libs/cq/tagging/gui/content/tags/tagedit.html/content/cq:tags/path/to/tag/here

Defining localization of Tag and saving changes causes generation of jcr:title properties with suffix defining locale in lower case, i.e.:
jcr:title.pt_br="Portuguese Brazil Title"

I have found two issues related to the mock of this functionality. Both of them were reproducible with the latest version 2.4.6 of io.wcm.testing.aem-mock.junit4 dependency. I have also checked with different sling resource types (including JCR_OAK). I have compared the behavior with AEM 6.4.3 however I am pretty sure it was the same for AEM 6.2 at least.

1) The logic in MockTag.getLocalizedTitle(Locale) tries to load property with the country code in upper case, i.e.

jcr:title.pt_BR="Portuguese Brazil Title"

It is because of these lines of code in the method:

{{String localeStr = locale.getLanguage() + "_" + locale.getCountry();
String title = properties.get(JcrConstants.JCR_TITLE + "." + localeStr, String.class);}}

I have also tested it with JCR_OAK however it does not make any difference.

The simple workaround solution for this issue is to use this method instead:

MockTag.getLocalizedTitles().get(locale)

2) AEM seems to escape some characters in the provided title whereas MockTag is no escaping them, i.e.:

If the property of a tag has value:
jcr:title.pt_br="Portuguese Brazil / Title"

Calling method below gives different responses:

MockTag.getLocalizedTitles().get(locale)

In the case of AEM Mocks: Portuguese Brazil / Title
In the case of AEM: Portuguese Brazil Title

Status

Assignee

Stefan Seifert

Reporter

Kamil Ciecierski

Labels

None

Components

Fix versions

Affects versions

Priority

Minor
Configure