/** * Saves or updates the translation for the specified locale. * If the key was outdated, checks if the key is still outdated. * * @param locale specified the translation locale * @param value translation value * @param approximate translation approximate indicator * @param outdated translation outdated indicator * @throws java.lang.IllegalArgumentException if locale is blank */ public void addTranslation(String locale, String value, boolean approximate, boolean outdated) { Preconditions.checkArgument(StringUtils.isNotBlank(locale)); // If exists, get the translation for the given locale Translation translation = this.translations.get(locale); if (translation == null) { translation = new Translation(); translation.setEntityId(new TranslationId(entityId, locale)); } translation.setValue(value); translation.setApproximate(approximate); translation.setOutdated(outdated); translation.setKey(this); translations.put(locale, translation); updateOutdated(); }