|
|
|
@@ -1,6 +1,3 @@
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
package de.bstly.we.i18n.controller;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
@@ -58,7 +55,7 @@ public class I18nController extends BaseController {
|
|
|
|
|
* @throws IOException Signals that an I/O exception has occurred.
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/{locale}")
|
|
|
|
|
public void getLabel(@PathVariable("locale") String locale, HttpServletResponse response)
|
|
|
|
|
public void getLabel(@PathVariable String locale, HttpServletResponse response)
|
|
|
|
|
throws JsonIOException, IOException {
|
|
|
|
|
JsonObject label = i18nManager.getLabel(locale);
|
|
|
|
|
if (label != null) {
|
|
|
|
@@ -75,7 +72,7 @@ public class I18nController extends BaseController {
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
|
|
|
|
@PostMapping("/{locale}")
|
|
|
|
|
public void setLabel(@PathVariable("locale") String locale, @RequestBody Object label) {
|
|
|
|
|
public void setLabel(@PathVariable String locale, @RequestBody Object label) {
|
|
|
|
|
JsonElement element = gson.toJsonTree(label);
|
|
|
|
|
|
|
|
|
|
if (element != null && element.isJsonObject()) {
|
|
|
|
@@ -91,7 +88,7 @@ public class I18nController extends BaseController {
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
|
|
|
|
@PutMapping("/{locale}")
|
|
|
|
|
public void addLabel(@PathVariable("locale") String locale, @RequestBody Object label) {
|
|
|
|
|
public void addLabel(@PathVariable String locale, @RequestBody Object label) {
|
|
|
|
|
JsonElement element = gson.toJsonTree(label);
|
|
|
|
|
|
|
|
|
|
if (element != null && element.isJsonObject()) {
|
|
|
|
@@ -106,7 +103,7 @@ public class I18nController extends BaseController {
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
|
|
|
|
@DeleteMapping("/{locale}")
|
|
|
|
|
public void deleteLocale(@PathVariable("locale") String locale) {
|
|
|
|
|
public void deleteLocale(@PathVariable String locale) {
|
|
|
|
|
i18nManager.deleteLabel(locale);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|