using System;
using System.Globalization;
using System.Resources;
using System.Diagnostics;
using System.Reflection;

namespace Routrek.SSHC 
{
	/// <summary>
	/// StringResource ÌTvÌà¾Å·B
	/// </summary>
	internal class StringResources {
		private string _resourceName;
		private ResourceManager _resMan;

		public StringResources(string name, Assembly asm) {
			_resourceName = name;
			LoadResourceManager(name, asm);
		}

		public string GetString(string id) 
		{
			try
			{
				return _resMan.GetString(id); //àµ±êªx¢æ¤Èç±ÌNXÅLbVÅàÂ­êÎ¢¢¾ë¤
			}
			catch
			{
				return "error loading string";
			}
		}

		private void LoadResourceManager(string name, Assembly asm) {
			//ÊÍpêEú{êµ©µÈ¢
			CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentUICulture;
			//if(ci.Name.StartsWith("ja"))
				//_resMan = new ResourceManager(name+"_ja", asm);
			//else
			_resMan = new ResourceManager(name, asm);
		}
	}
}