// <copyright file="Translator.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

namespace FSI.BT.Tools.Global.Utilities
{
    using System.Globalization;
    using System.Resources;
    using FSI.BT.Tools.SystemTrayMenu.UserInterface;

    internal static class Translator
    {
        private static CultureInfo culture;

        internal static void Initialize()
        {
            if (string.IsNullOrEmpty(
                Vars.SystemTrayMenuSettings.CurrentCultureInfoName))
            {
                Vars.SystemTrayMenuSettings.CurrentCultureInfoName = "de";
                //Global.Vars.SystemTrayMenuSettings.Save();
            }

            culture = CultureInfo.CreateSpecificCulture(
                Vars.SystemTrayMenuSettings.CurrentCultureInfoName);
        }

        internal static string GetText(string id)
        {
            ResourceManager rm = new(
                "FSI.BT.Tools.Global.Resources.Languages.lang",
                typeof(Menu).Assembly);
            return rm.GetString(id, culture);
        }
    }
}
