package com.ssyf.common.web.i18n;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * 动态国际化数据源
 * 预计由nacos动态加载并实时更新
 * @author huwei
 * @date 2022/7/5 11:51
 */
@RefreshScope
@Data
@Configuration
@ConfigurationProperties(prefix = "i18n")
public class MessageProperties {
    /**
     * 动态配置
     */
    private Map<String ,Map<String ,String>> message = new HashMap<>();

    /**
     * 默认消息
     */
    private String common = "default";

    public Map<String, String> getDefaultMessage() {
        return this.message.get(this.common);
    }
}
