mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
18.09.2021 ea8ad4f8ce1208a08efc8557240c5499b06e4b9a
borgbutler-server/src/main/kotlin/de/micromata/borgbutler/server/rest/I18nRest.kt
@@ -19,24 +19,20 @@
     * @param request For detecting the user's client locale.
     * @param locale If not given, the client's language (browser) will be used.
     * @param keysOnly If true, only the keys will be returned. Default is false.
     * @param prettyPrinter If true then the json output will be in pretty format.
     * @see JsonUtils.toJson
     */
    @GetMapping("list")
    fun getList(
        request: HttpServletRequest,
        @RequestParam("prettyPrinter", required = false) prettyPrinter: Boolean?,
        @RequestParam("keysOnly", required = false) keysOnly: Boolean?,
        @RequestParam("locale", required = false) locale: String?
    ): String {
    ): Map<String, String> {
        val localeObject: Locale?
        if (StringUtils.isNotBlank(locale)) {
            localeObject = Locale(locale)
        } else {
            localeObject = RestUtils.getUserLocale(request)
        }
        val translations: Map<String, String> =
            I18nClientMessages.getInstance().getAllMessages(localeObject, keysOnly == true)
        return JsonUtils.toJson(translations, prettyPrinter)
        return I18nClientMessages.getInstance().getAllMessages(localeObject, keysOnly == true)
    }
}