2021-08-06 18:59:28 +08:00
|
|
|
package com.ruoyi.demo.controller;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.utils.MessageUtils;
|
2021-09-03 16:21:23 +08:00
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
2021-11-18 17:01:23 +08:00
|
|
|
import io.swagger.annotations.ApiParam;
|
2021-08-06 18:59:28 +08:00
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 测试国际化
|
|
|
|
*
|
|
|
|
* @author Lion Li
|
|
|
|
*/
|
2021-09-03 16:21:23 +08:00
|
|
|
@Api(value = "测试国际化控制器", tags = {"测试国际化管理"})
|
2021-08-06 18:59:28 +08:00
|
|
|
@RestController
|
|
|
|
@RequestMapping("/demo/i18n")
|
|
|
|
public class TestI18nController {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 通过code获取国际化内容
|
|
|
|
* code为 messages.properties 中的 key
|
|
|
|
*
|
|
|
|
* 测试使用 user.register.success
|
|
|
|
*/
|
2021-09-03 16:21:23 +08:00
|
|
|
@ApiOperation("通过code获取国际化内容")
|
2021-08-06 18:59:28 +08:00
|
|
|
@GetMapping()
|
2021-11-18 17:01:23 +08:00
|
|
|
public AjaxResult<Void> get(@ApiParam("国际化code") String code) {
|
2021-08-06 18:59:28 +08:00
|
|
|
return AjaxResult.success(MessageUtils.message(code));
|
|
|
|
}
|
|
|
|
}
|