using System.Globalization; namespace MeterVault.App; /// Small display formatters for the UI (locale-aware formatting arrives with i18n in M7). public static class Format { private static readonly CultureInfo Culture = CultureInfo.GetCultureInfo("de-DE"); public static string Euro(double value) => value.ToString("N2", Culture) + " €"; public static string Number(double value, int decimals = 0) => value.ToString("N" + decimals.ToString(CultureInfo.InvariantCulture), Culture); public static string Percent(double value) => (value >= 0 ? "+" : "") + value.ToString("N1", Culture) + " %"; public static string DirectionIcon(int direction) => direction switch { > 0 => "▲", < 0 => "▼", _ => "—", }; }