feat(NightJson): add arbitrary key-val pairs via map
This commit is contained in:
@@ -6,14 +6,14 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Translation {
|
||||
public static Map<String, String> translationMap = new HashMap<>();
|
||||
public static Map<String, String> jsonMap = new HashMap<>();
|
||||
|
||||
public static void load(String locale) {
|
||||
NightJson json = new NightJson(translationMap, String.format("translation/%s.json5", locale));
|
||||
NightJson json = new NightJson(Translation.class, String.format("translation/%s.json5", locale));
|
||||
json.readJson();
|
||||
}
|
||||
|
||||
public static String t(String key, Object... args) {
|
||||
return String.format(translationMap.getOrDefault(key, key), args);
|
||||
return String.format(jsonMap.getOrDefault(key, key), args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user