mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-09-24 15:46:03 +08:00
Support internationalization
This commit is contained in:
@ -6,14 +6,12 @@ package ai.chat2db.server.web.api.controller;
|
||||
|
||||
import ai.chat2db.server.tools.base.wrapper.result.DataResult;
|
||||
import ai.chat2db.server.tools.common.config.AliDbhubProperties;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import ai.chat2db.server.tools.common.util.I18nUtils;
|
||||
import ai.chat2db.spi.sql.SSHManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -34,8 +32,6 @@ public class SystemController {
|
||||
|
||||
@Autowired
|
||||
private AliDbhubProperties aliDbhubProperties;
|
||||
@Resource
|
||||
private MessageSource messageSource;
|
||||
|
||||
/**
|
||||
* 检测是否成功
|
||||
@ -45,10 +41,8 @@ public class SystemController {
|
||||
@GetMapping
|
||||
public DataResult<String> get() {
|
||||
log.info("locale:{}", LocaleContextHolder.getLocale());
|
||||
log.info("error message:{}",
|
||||
messageSource.getMessage("COMMON_SYSTEM_ERROR", null, LocaleContextHolder.getLocale()));
|
||||
log.info("error message:{}",
|
||||
messageSource.getMessage("COMMON_SYSTEM_ERROR2", null, LocaleContextHolder.getLocale()));
|
||||
log.info("error message:{}", I18nUtils.getMessage("common.systemError"));
|
||||
log.info("error message:{}", I18nUtils.getMessage("common.paramDetailError", new Object[] {"参数呀"}));
|
||||
return DataResult.of("success");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user