- java.lang.Object
-
- cn.mcres.karlatemp.mxlib.translate.TranslateLoader
-
public class TranslateLoader extends Object
A Loader to load translates.public class Logging{ private static final MTranslate translate = TranslateLoader.loadTranslate( Logging.class::getResourceAsStream, "language", null, ".properties", TranslateLoader.PARSER_PROPERTIES, (path, error) -> { System.err.println("Error in loading resource " + path); error.printStackTrace(); } ); }
- 从以下版本开始:
- 2.9
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static interface
TranslateLoader.ResourceParser
-
字段概要
字段 修饰符和类型 字段 说明 static TranslateLoader.ResourceParser
PARSER_JSON
static TranslateLoader.ResourceParser
PARSER_PROPERTIES
-
构造器概要
构造器 构造器 说明 TranslateLoader()
-
方法概要
修饰符和类型 方法 说明 static MTranslate
loadTranslate(@NotNull Function<String,InputStream> resourceLoader, @NotNull String name, Locale locale, @NotNull String suffix, @NotNull TranslateLoader.ResourceParser resourceParser, @NotNull BiConsumer<String,Throwable> errorCatch)
static MTranslate
loadTranslates(@NotNull Function<String,List<InputStream>> resourceLoader, @NotNull String name, Locale locale, @NotNull String suffix, @NotNull TranslateLoader.ResourceParser resourceParser, @NotNull BiConsumer<String,Throwable> errorCatch)
Load translates from resource.
-
-
-
字段详细资料
-
PARSER_PROPERTIES
public static final TranslateLoader.ResourceParser PARSER_PROPERTIES
-
PARSER_JSON
public static final TranslateLoader.ResourceParser PARSER_JSON
-
-
方法详细资料
-
loadTranslates
public static MTranslate loadTranslates(@NotNull @NotNull Function<String,List<InputStream>> resourceLoader, @NotNull @NotNull String name, Locale locale, @NotNull @NotNull String suffix, @NotNull @NotNull TranslateLoader.ResourceParser resourceParser, @NotNull @NotNull BiConsumer<String,Throwable> errorCatch)
Load translates from resource.- 参数:
resourceLoader
- Resources loadername
- The path of resource.locale
- The using localesuffix
- The suffix of resource. Eg: ".json"resourceParser
- The parser of resourceerrorCatch
- A Catcher- 返回:
- Loaded translate.
- 从以下版本开始:
- 2.12
-
loadTranslate
public static MTranslate loadTranslate(@NotNull @NotNull Function<String,InputStream> resourceLoader, @NotNull @NotNull String name, Locale locale, @NotNull @NotNull String suffix, @NotNull @NotNull TranslateLoader.ResourceParser resourceParser, @NotNull @NotNull BiConsumer<String,Throwable> errorCatch)
-
-