Skip to content

Commit

Permalink
fixes issue for deleting keys that did not have a translation yet
Browse files Browse the repository at this point in the history
  • Loading branch information
royteeuwen committed Sep 16, 2024
1 parent 69a91f6 commit ccfaa6f
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import java.util.*;

import static be.orbinson.aem.dictionarytranslator.utils.DictionaryConstants.SLING_MESSAGEENTRY;

@Component(
service = ResourceProvider.class,
property = {
Expand Down Expand Up @@ -45,8 +47,8 @@ private Map<String, Object> getValuesAndMessageEntryPaths(Resource dictionaryRes
Resource languageResource = dictionaryService.getLanguageResource(dictionaryResource, language);
if (languageResource != null) {
Resource messageEntryResource = dictionaryService.getMessageEntryResource(languageResource, key);
if (messageEntryResource != null && (messageEntryResource.getValueMap().containsKey(DictionaryConstants.SLING_MESSAGE))) {
properties.put(language, messageEntryResource.getValueMap().get(DictionaryConstants.SLING_MESSAGE, String.class));
if (messageEntryResource != null && messageEntryResource.isResourceType(DictionaryConstants.SLING_MESSAGEENTRY)) {
properties.put(language, messageEntryResource.getValueMap().get(DictionaryConstants.SLING_MESSAGE, ""));
messageEntryPaths.add(messageEntryResource.getPath());
}
}
Expand Down Expand Up @@ -96,7 +98,7 @@ private boolean isMessageEntry(Resource dictionaryResource, String key) {
Resource languageResource = dictionaryService.getLanguageResource(dictionaryResource, language);
if (languageResource != null) {
Resource messageEntryResource = dictionaryService.getMessageEntryResource(languageResource, key);
if (messageEntryResource != null && messageEntryResource.isResourceType(DictionaryConstants.SLING_MESSAGEENTRY)) {
if (messageEntryResource != null && messageEntryResource.isResourceType(SLING_MESSAGEENTRY)) {
return true;
}
}
Expand Down

0 comments on commit ccfaa6f

Please sign in to comment.