Initial project
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.imyeyu.lang.mapper;
|
||||
|
||||
import com.imyeyu.io.IO;
|
||||
import com.imyeyu.java.bean.Language;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author 夜雨
|
||||
* @version 2024-04-09 01:00
|
||||
*/
|
||||
public class FileLanguageMap extends PropertiesLanguageMap {
|
||||
|
||||
/**
|
||||
* 默认构造
|
||||
*
|
||||
* @param language 所属语言
|
||||
*/
|
||||
public FileLanguageMap(Language language) {
|
||||
super(language);
|
||||
}
|
||||
|
||||
public void load(String path) {
|
||||
try {
|
||||
InputStream is = IO.getInputStream(path.formatted(language.toString()));
|
||||
Properties properties = new Properties();
|
||||
properties.load(new InputStreamReader(is));
|
||||
load(properties);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("load language properties file error", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user