public Message build() { String text; String detail = null; try { text = bundles.get(clientLocale, textKey.getBundle()).getString(textKey.getKey()); if (detailKey != null) { detail = bundles.get(clientLocale, detailKey.getBundle()).getString(detailKey.getKey()); } } catch (Exception e) { log.warn("Could not load bundle: " + textKey); text = textDefault; } if ((text == null) || "".equals(text)) { text = textKey.toString(); } template.text(text); if (detail != null) { template.detail(detail); } return template.build(); }