@Override public void translate(String keyName, String locale, String translation) { if (isEmpty(keyName)) { throw new IllegalArgumentException(String.format(IS_EMPTY_ERROR_MESSAGE, "key name")); } if (isEmpty(locale)) { throw new IllegalArgumentException(String.format(IS_EMPTY_ERROR_MESSAGE, "locale")); } Key key = keyRepository.get(keyName).orElseThrow(() -> new IllegalArgumentException( "The locale " + locale + " is not available.")); if (isEmpty(translation)) { key.removeTranslation(locale); } else { updateTranslation(locale, translation, key); } }