StringResource.cs
上传用户:szltgg
上传日期:2019-05-16
资源大小:604k
文件大小:1k
- /*
- * Copyright (c) 2005 Poderosa Project, All Rights Reserved.
- * $Id: StringResource.cs,v 1.2 2005/04/20 08:45:46 okajima Exp $
- */
- using System;
- using System.Globalization;
- using System.Resources;
- using System.Reflection;
- namespace Poderosa.Toolkit {
- /// <summary>
- /// StringResource 偺奣梫偺愢柧偱偡丅
- /// </summary>
- public class StringResources {
- private string _resourceName;
- private ResourceManager _resMan;
- public StringResources(string name, Assembly asm) {
- _resourceName = name;
- LoadResourceManager(name, asm);
- }
- public string GetString(string id) {
- return _resMan.GetString(id); //傕偟偙傟偑抶偄傛偆側傜偙偺僋儔僗偱僉儍僢僔儏偱傕偮偔傟偽偄偄偩傠偆
- }
- private void LoadResourceManager(string name, Assembly asm) {
- //摉柺偼塸岅丒擔杮岅偟偐偟側偄
- CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentUICulture;
- if(ci.Name.StartsWith("ja"))
- _resMan = new ResourceManager(name+"_ja", asm);
- else
- _resMan = new ResourceManager(name, asm);
- }
- }
- }