@ PUT @ Path ( "/{key}" ) @ Consumes ( MediaType . APPLICATION_JSON ) @ Produces ( MediaType . APPLICATION_JSON ) @ RequiresPermissions ( I18nPermissions . TRANSLATION_WRITE ) public Response updateTranslation ( @ PathParam ( "key" ) String keyName , TranslationRepresentation representation ) { WebAssertions . assertNotNull ( representation , "The translation should not be null" ) ; TranslationValueRepresentation translationToUpdate = representation . getTarget ( ) ; WebAssertions . assertNotNull ( translationToUpdate , "The translation target should not be null" ) ; Key key = keyRepository . get ( keyName ) . orElseThrow ( ( ) -> new NotFoundException ( "The key is not found" ) ) ; key . addTranslation ( locale , translationToUpdate . getTranslation ( ) , translationToUpdate . isApprox ( ) ) ; keyRepository . update ( key ) ; return Response . noContent ( ) . build ( ) ; }
Update translation for the given locale .