Use localization and multiple languages
masterThe library supports 29 languages. You can specify a locale in three ways:
- Per-call: Pass the
Localeproperty in anOptionsobject toGetDescription. - Globally: Call
ExpressionDescriptor.SetDefaultLocale("locale_code")to set a default for all subsequent calls. - System Culture: On platforms supporting .NET Standard >= 2.0, the library will respect
Thread.CurrentThread.CurrentUICultureif noLocaleoption is provided.
Supported Locales:
en, zh-Hans (zh-CN), zh-Hant (zh-TW), cz, da, nl, fi, fr, de, he, hu, it, ja, ko, nb, fa, pl, pt-BR, ro, ru, sl-SI, es, es-MX, sv, vi, tr, uk, el, kk, ky.
// Example: Using a specific locale per call
ExpressionDescriptor.GetDescription("0-10 11 * * *", new Options(){ Locale = "de" });
// Returns: "Jede Minute zwischen 11:00 und 11:10"
// Example: Setting a global default locale
ExpressionDescriptor.SetDefaultLocale("es");
ExpressionDescriptor.GetDescription("*/45 * * * * *");
// Returns: "Cada 45 segundos"