compile library
stringlocale build-time API (compiler, check, prune, LLM drafters). Import this only in build scripts — not in app/runtime code.
Classes
- CompileResult
- Drafter
- LlmDrafter
-
LLM-backed drafter for any OpenAI-compatible
/chat/completionsAPI (OpenRouter, OpenAI, Groq, Together, a local Ollama/LM Studio server, etc.). - OfflineDrafter
- Deterministic, no-network drafter — builds a testable bundle without a key.
- OpenRouterDrafter
- OpenRouter-flavored LlmDrafter: defaults the endpoint to OpenRouter and sends OpenRouter's optional attribution headers. Kept for backward compatibility — LlmDrafter works with any OpenAI-compatible API.
- PruneResult
- Report
Constants
- defaultBaseUrl → const String
-
Default endpoint (OpenRouter). Any OpenAI-compatible
/chat/completionsendpoint works — see LlmDrafter. - defaultModel → const String
Functions
-
check(
List< StringLocale> ? strings, String bundleDir, {List<String> ? locales}) → Report -
compileAll(
{required List< String> locales, Object? drafter, String sourceLocale = 'en', bool force = false, String? existingDir, void log(String)?}) → Future<CompileResult> - Sweep the global registry and compile every declared string.
-
compileStrings(
{required List< StringLocale> strings, required List<String> locales, Object? drafter, String sourceLocale = 'en', bool force = false, String? existingDir, void log(String)?}) → Future<CompileResult> - Compile an explicit list. Drafters can be OfflineDrafter or OpenRouterDrafter.
-
parseLocaleArg(
String value) → String - Parse "code:Language" (or just "code") to the locale code.
-
prune(
List< StringLocale> ? strings, String bundleDir, {List<String> ? locales, bool dryRun = false}) → PruneResult -
slHash(
List< String> parts) → String - Stable 16-hex hash (two 32-bit FNV-1a accumulators kept positive).