Skip to content

Commit

Permalink
feat: weblate integration
Browse files Browse the repository at this point in the history
  • Loading branch information
tkuzynow committed Nov 22, 2023
1 parent 91290c4 commit 6b481ca
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import java.util.Map;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
Expand All @@ -22,10 +23,17 @@ public ResponseEntity<Map<String, String>> getTranslations() {
return new ResponseEntity<>(result, org.springframework.http.HttpStatus.OK);
}

@RequestMapping(value = "/translations/{lang}")
public ResponseEntity<Map<String, String>> getTranslations(@PathVariable("lang") String languageCode) {
var result = translationService.fetchTranslations(languageCode);
return new ResponseEntity<>(result, org.springframework.http.HttpStatus.OK);
}

@RequestMapping(value = "/translations/evict")
public ResponseEntity<Void> evictTranslationCache() {
@ResponseBody
public String evictTranslationCache() {
translationService.evictCache();
return new ResponseEntity<>(HttpStatus.OK);
return "Cache evicted";
}

}

0 comments on commit 6b481ca

Please sign in to comment.