code: @PUT
      @Consumes(MediaType.APPLICATION_JSON)
      @Produces(MediaType.APPLICATION_JSON)
      @RequiresPermissions(I18nPermissions.LOCALE_WRITE)
      public Response replaceAvailableLocales(List<LocaleRepresentation> representations,
              @Context UriInfo uriInfo) throws URISyntaxException {
          // Delete the old list of available locales
          localeRepository.clear();
          if (representations != null && !representations.isEmpty()) {
              // Gets the new list of available locales
              List<Locale> locales = new ArrayList<>();
              String defaultLocale = localeService.getDefaultLocale();
              for (LocaleRepresentation representation : representations) {
                  boolean isDefault =
                          StringUtils.isNotBlank(defaultLocale) && defaultLocale.equals(representation.getCode());
                  Locale locale = factory.createFromCode(representation.getCode());
                  locale.setDefaultLocale(isDefault);
                  locales.add(locale);
              }
              // And persist the new
              for (Locale locale : locales) {
                  localeRepository.addOrUpdate(locale);
              }
  
              return Response.ok(new URI(uriInfo.getRequestUri() + "/"))
                      .entity(localeFinder.findAvailableLocales()).build();
          } else {
              return Response.noContent().build();
          }
      }
docs: Updates the list of available locales.
  
  @param representations new list of available locales
  @param uriInfo         uriInfo
  @return status code 200 with updated representations, or 204 if representations list was empty
  @throws java.net.URISyntaxException if URI is not valid