I wanted to retrieveretrieved the details using the Metadata APIapex-mdapi. Anyway, you can use the belowExample code below:
List<String> labels = new List<String>{'Demo1'};
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
Map<String, String> valuesByKey = new Map<String, String>();
MetadataService.Translations translations = (MetadataService.Translations) service.readMetadata('Translations',
new String[] { 'en_US' }).getRecords()[0];
for(MetadataService.CustomLabelTranslation customLabelTranslation : translations.customLabels) {
if (labels.contains(customLabelTranslation.name)) {
valuesByKey.put(customLabelTranslation.name, customLabelTranslation.label);
}
}
System.debug(valuesByKey);