日期:2014-05-18  浏览次数:20470 次

求助 关于多语言网站 简体——繁体
我想实现简体版、繁体版调用同一个数据库,
并且数据中的数据是简体
我现在想在前台简体版显示简体,繁体版转化成繁体,
可以实现吗?

------解决方案--------------------
不用那么麻烦,有一个可以直接转换的方法...
------解决方案--------------------
public string Traditional2Simplified( string str)
{//繁体转简体
return(Microsoft.VisualBasic.Strings.StrConv(str, Microsoft.VisualBasic.VbStrConv.SimplifiedChinese,0));

}
public string Simplified2Traditional( string str)
{//简体转繁体
return(Microsoft.VisualBasic.Strings.StrConv(str as String, Microsoft.VisualBasic.VbStrConv.TraditionalChinese,0));

}

------解决方案--------------------
呵呵。.
1.可以用资源文件做多语言的。
在03里面的话,添加"程序集资源文件",它是XML来的,
string.ZH-CN.resx:
<data name= "zcfz ">
<value> 资产负债 </value>
</data>
<data name= "gy ">
<value> 港币 </value>
</data>
string.ZH-HK.resx:
<data name= "zcfz ">
<value> 資產負債 </value>
</data>
<data name= "gy ">
<value> 港幣 </value>
</data>
在程序里面加入
using System.Threading;
using System.Globalization;
using System.Resources;

public class multilanguage
{
protected CultureInfo ci=null;
protected ResourceManager resmanager=null;

#region 语言类型
/// <summary>
/// 界面类型,CN为中文,HK为中文繁体
/// </summary>
protected string Language;
protected string img;
private string _type;
public string Type
{
get
{

if(_type!=null&&_type!=string.Empty&&_type!= " ")
{
_type=_type.ToUpper();
if(_type== "TC ")
{
Language= "TC ";
this.img= "imagesHK ";
}
else
{
Language= "SC ";
this.img= "images ";
}
}
else if(Request.QueryString[ "lgtype "]!=null)
{
img=Request.QueryString[ "lgtype "].ToString().ToUpper();
if(img== "TC ")
{
Language= "TC ";
this.img= "imagesHK ";
}
else
{
Language= "SC ";
this.img= "images ";
}
}
else
{
Language= "SC ";
this.img= "Images ";
}
return img;
}
set
{
this._type=value;
}
}

private string _lgtype;
private string LGType
{
get
{
this._lgtype=Type.ToLower();
if(_lgtype== "imageshk ")
{
this._lgtype= "ZH-HK ";
}
else
{
this._lgtype= "ZH-CN ";
}
return _lgtype;
}
}
#endregion

private void Page_Load(object sender, System.EventArgs e)
{
if(!this.IsPostBack)
{
Thread.CurrentThread.CurrentCulture=CultureInfo.CreateSpecificCulture(LGType);
类名 class=new 类名();
resmanager=new ResourceManager( "项目名.string ",class.GetType().Assembly);
ci=Thread.CurrentThread.CurrentCulture;
}

可以用resmanager.GetString( "资源文件里面的name ",ci)这样来获资源文件里面的值;