sharepoint站点的多语言不再累赘,网上多的是,可是自定义webpart有时候也需要多语言
1、建立资源文件
2、代码部分
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Resources;
using System.Reflection;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(System.Threading.Thread.CurrentThread.CurrentUICulture.ToString());
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture("zh-tw");
string lan = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString();
//string aa = "I've set up the webpart so that the title of the document is a hyperlink to the encodedabsurl field. This give a link directly to the ";
//Console.Write( Encoding.GetEncoding(aa));
//Resource1.String1
ResourceManager rm = new ResourceManager("ConsoleApplication1.Resource1", Assembly.GetExecutingAssembly());
string tt = rm.GetString("String1");
Console.Write(tt);
}
}
}