public static String getMessage(Locale locale, String key) {
   try {
     // It retrieves the value based on the key and locale, it does not take
     // into account the bundle name
     MessageSourcePK messageSourcePK = new MessageSourcePK(key, locale.toString());
     String value = null;
     try {
       MessageSource ms = MessageSourceLocalServiceUtil.getMessageSource(messageSourcePK);
       value = ms.getValue();
     } catch (NoSuchMessageSourceException ignored) {
     }
     return (String) value;
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }