whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
src/main/java/com/fgkj/controller/I18nController.java
@@ -1,15 +1,23 @@
package com.fgkj.controller;
import java.util.Locale;
import com.fgkj.util.*;
import com.fgkj.dto.ServiceModel;
import com.opensymphony.xwork2.ActionContext;
import com.fgkj.util.*;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Locale;
import javax.annotation.Resource;
@RequestMapping("i18n")
@RestController
@Api
@Api(tags = "i18n接口")
public class I18nController{
   // private String lanuage;
@@ -27,6 +35,7 @@
   
   //切换中英文环境
   @PutMapping("locale")
   @ApiOperation(notes = "",value="切换中英文环境")
   public boolean SetLocale(@RequestParam String lanuage){
      boolean res=false;
      Locale local = Locale.getDefault();
@@ -39,7 +48,8 @@
         }
         //System.out.println(local.getCountry());
      }
      ActionContext.getContext().setLocale(local);
      // ActionContext.getContext().setLocale(local);
      ActionUtil.getSession().setAttribute("WW_TRANS_I18N_LOCALE", local);
      res=true;
      return res;