Path: redb-route/redb.Route/Expressions/ExpressionFormatting.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Expressions/ExpressionFormatting.cs ---- using System.Globalization; namespace redb.Route.Expressions; /// /// The culture lookup behind the language's format(value, pattern[, culture]) function, shared /// by the compiled and the interpreted branch of the engine so both answer alike. /// internal static class ExpressionFormatting { /// /// The culture named by ; no name means invariant. An unknown name is an /// error rather than a silent fall back to invariant: a route that formats money for the wrong /// locale must say so at once, not ship plausible-looking text. /// public static CultureInfo Culture(string? name) { if (string.IsNullOrWhiteSpace(name)) return CultureInfo.InvariantCulture; try { // predefinedOnly: ICU (Linux, macOS) builds a culture from any well-formed tag, 'kl-INGON' included, with // the formats of its language or of none; only the list of known cultures turns such a name down. return CultureInfo.GetCultureInfo(name, predefinedOnly: true); } catch (CultureNotFoundException ex) { throw new ArgumentException( $"format(): '{name}' is not a known culture name (use an IETF tag such as 'ru-RU', or omit the argument for the invariant culture).", nameof(name), ex); } } }