package com.fgkj.controller;
|
|
import java.util.Locale;
|
|
import com.fgkj.dto.ServiceModel;
|
import com.opensymphony.xwork2.ActionContext;
|
import io.swagger.annotations.Api;
|
import org.springframework.web.bind.annotation.*;
|
|
@RequestMapping("i18n")
|
@RestController
|
@Api
|
public class I18nController{
|
|
// private String lanuage;
|
// private String key;
|
// private String value;
|
|
public ServiceModel findValue(){
|
ServiceModel model=new ServiceModel();
|
//System.out.println(key+"&&&&&&&&&&&&");
|
// value=this.getText(key); //这是Struts的ActionSupport的方法
|
//value=ActionUtil.tojson(value);
|
//System.out.println(value+"$$$$$$$");
|
return model;
|
}
|
|
//切换中英文环境
|
@PutMapping("locale")
|
public boolean SetLocale(@RequestParam String lanuage){
|
boolean res=false;
|
Locale local = Locale.getDefault();
|
if(lanuage!=null){
|
if("US".equalsIgnoreCase(lanuage)){
|
local = Locale.US;
|
|
}else if("CH".equalsIgnoreCase(lanuage)){
|
local = Locale.CHINA;
|
}
|
//System.out.println(local.getCountry());
|
}
|
ActionContext.getContext().setLocale(local);
|
ActionUtil.getSession().setAttribute("WW_TRANS_I18N_LOCALE", local);
|
res=true;
|
return res;
|
}
|
|
}
|