package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;

import java.util.Locale;

@RestController
@RequestMapping("/system/language")
public class SysLanguageController {

    @GetMapping("/change")
    public AjaxResult list(@RequestParam(name = "lang") @ApiParam(name = "lang", value = "语言", required = true) String lang)
    {
        return getLanguage();
    }


    @ApiOperation("获得当前语言")
    @GetMapping

    public AjaxResult getLanguage() {

        Locale locale = LocaleContextHolder.getLocale();
        return AjaxResult.success(locale.toString());

    }

}
