You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
939 B
32 lines
939 B
|
5 years ago
|
package net.mingsoft.config;
|
||
|
|
|
||
|
|
import com.jagregory.shiro.freemarker.ShiroTags;
|
||
|
|
import freemarker.template.TemplateException;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.beans.factory.annotation.Value;
|
||
|
|
import org.springframework.context.annotation.Configuration;
|
||
|
|
|
||
|
|
import javax.annotation.PostConstruct;
|
||
|
|
import java.io.IOException;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 读取国际化配置,传递给freemker
|
||
|
|
*/
|
||
|
|
@Configuration
|
||
|
|
public class I18NConfig {
|
||
|
|
@Autowired
|
||
|
|
protected freemarker.template.Configuration configuration;
|
||
|
|
|
||
|
|
@Value("${ms.local.default:zh_CN}")
|
||
|
|
private String defaultLocal;
|
||
|
|
@Value("${ms.local.messages:zh_CN,en_US}")
|
||
|
|
private String messages;
|
||
|
|
|
||
|
|
@PostConstruct
|
||
|
|
public void init() throws IOException, TemplateException {
|
||
|
|
configuration.setSharedVariable("localDefault",defaultLocal);
|
||
|
|
configuration.setSharedVariable("localMessages",messages.split(","));
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|