Class VanEngine
java.lang.Object
dev.vanengine.core.VanEngine
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddI18nFileParser(I18nFileParser parser) Register an additional i18n file parser (e.g.voidaddI18nMessages(String locale, Map<String, Object> messages) Register translation messages for a locale.static VanEngine.Builderbuilder()Compile a .van file and evaluate with model data in one step.compileLiteral(String templateContent, Map<String, ?> model) Compile an inline template and evaluate with model data in one step.Find keys present in defaultLocale but missing in other locales.getI18nMessages(String locale) Get translation messages for the given locale with key-level merge fallback.getLiteralTemplate(String templateContent) Compile an inline template string and return a reusable template.getMessage(String key, String locale) Get a translated message by dot-separated key (no parameters).getMessage(String key, String locale, Map<String, ?> params) Get a translated message by dot-separated key, with {placeholder} replacement.getTemplate(String templatePath) Compile a .van file from the filesystem and return a reusable template.getTemplate(String entryPath, Map<String, String> files) Compile from an explicit files map (for classpath resources) and return a reusable template.booleanWhether any i18n messages have been loaded.voidloadI18nFiles(Path i18nDir) Scan an i18n directory for translation files and load them.voidloadI18nFromStream(String locale, String extension, InputStream inputStream) Load i18n messages from a stream.voidClear and reload all i18n files from the basePath/i18n directory.voidsetBasePath(Path basePath) voidsetDefaultLocale(String defaultLocale) voidsetGlobalName(String globalName) voidsetMissingKeyStrategy(MissingKeyStrategy missingKeyStrategy) Return all file extensions currently supported by registered parsers.
-
Constructor Details
-
VanEngine
-
-
Method Details
-
setBasePath
-
setDefaultLocale
-
getDefaultLocale
-
setMissingKeyStrategy
-
getMissingKeyStrategy
-
setGlobalName
-
addI18nMessages
-
addI18nFileParser
Register an additional i18n file parser (e.g. YAML). -
supportedI18nExtensions
-
loadI18nFromStream
public void loadI18nFromStream(String locale, String extension, InputStream inputStream) throws IOException Load i18n messages from a stream. Used by starter for classpath loading.- Throws:
IOException
-
getI18nMessages
-
hasI18nMessages
public boolean hasI18nMessages()Whether any i18n messages have been loaded. -
getBasePath
-
loadI18nFiles
Scan an i18n directory for translation files and load them. Supports all extensions registered viaaddI18nFileParser(I18nFileParser). -
reloadI18nFiles
public void reloadI18nFiles()Clear and reload all i18n files from the basePath/i18n directory. -
builder
-
getTemplate
Compile a .van file from the filesystem and return a reusable template.- Throws:
IOException
-
getTemplate
Compile from an explicit files map (for classpath resources) and return a reusable template.- Throws:
IOException
-
getLiteralTemplate
Compile an inline template string and return a reusable template.- Throws:
IOException
-
getMessage
-
getMessage
-
findMissingKeys
-
compile
Compile a .van file and evaluate with model data in one step.- Throws:
IOException
-
compileLiteral
Compile an inline template and evaluate with model data in one step.- Throws:
IOException
-