using System.Globalization;
using System.Threading;
using MultiLanguageManger;

namespace QC.QMSCT.Language;

public class QMSCTMultiLanguageManger
{
	public enum Language
	{
		ENGLISH,
		CHINESE
	}

	private Language currentLang;

	public Language CurrentLanguage
	{
		get
		{
			return currentLang;
		}
		set
		{
			currentLang = value;
			if (currentLang == Language.ENGLISH)
			{
				SetCultureInfo("en-US");
			}
			else
			{
				SetCultureInfo("zh-CN");
			}
		}
	}

	public static string GetString(string data, CultureInfo cultureInfo)
	{
		return CommonResource.ResourceManager.GetString(data, cultureInfo);
	}

	private void SetCultureInfo(string culture)
	{
		CultureInfo cultureInfo = new CultureInfo(culture);
		Thread.CurrentThread.CurrentCulture = cultureInfo;
		Thread.CurrentThread.CurrentUICulture = cultureInfo;
	}
}
