    using System;
    using System.Collections.Generic;
    using System.Threading;
    using Microsoft.Extensions.Localization;
    using MudBlazor;

    internal class DictionaryMudLocalizer : MudLocalizer
    {
        private Dictionary<string, string> _localization;

        public DictionaryMudLocalizer()
        {
            _localization = new()
            {
                { "MudDataGrid_IsEmpty", "ist leer" },
                { "MudDataGrid_IsNotEmpty", "ist nicht leer" },
                { "MudDataGrid_Contains", "enthält" },
                { "MudDataGrid_NotContains", "enthält nicht" },
            };
        }

        public override LocalizedString this[string key]
        {
            get
            {
                var currentCulture = Thread.CurrentThread.CurrentUICulture.Parent.TwoLetterISOLanguageName;
                if (currentCulture.Equals("de", StringComparison.InvariantCultureIgnoreCase)
                    && _localization.TryGetValue(key, out var res))
                {
                    return new(key, res);
                }
                else
                {
                    return new(key, key, true);
                }
            }
        }
    }