Ustvarite Resource file z Visual Studio IDE
Kopirajte datoteko z viri v 12 panj virov mape
GetLocalized metode iz SPUtility za branje vrednosti iz datoteke vira
Skladnja:
SPUtility.GetLocalizedString(“$Viri:<<ResourceFileName,ResourceKeyName>>”, “<<ResourceFileName>>”, dolge);
Primer:
SPUtility.GetLocalizedString(“$Viri:MyResources,FirstName”, “MyResources”, dolge);
Sample Vir:
uporabo System;
uporabo System.Runtime.InteropServices;
uporabo System.Web.UI;
uporabo System.Web.UI.WebControls;
uporabo System.Web.UI.WebControls.WebParts;
uporabo System.Xml.Serialization;
uporabo Microsoft.SharePoint;
uporabo Microsoft.SharePoint.WebControls;
uporabo Microsoft.SharePoint.WebPartPages;
uporabo Microsoft.SharePoint.Utilities;
namespace ResourceFile
{
[Guid(“fc643df7-8836-41bf-913f-662ed57e659a”)]
javnih
razred
ResourceCollection : System.Web.UI.WebControls.WebParts.WebPart
{
string FirstName;
string Priimek;
javnih ResourceCollection()
{
}
zaščiteni
preglasijo
neveljaven CreateChildControls()
{
baza.CreateChildControls();
uint lang = SPContext.Current.Web.Language;
FirstName = SPUtility.GetLocalizedString(“$Viri:MyResources,FirstName”, “MyResources”, dolge);
Priimek = SPUtility.GetLocalizedString(“$Viri:MyResources,Priimek”, “MyResources”, dolge);
}
zaščiteni
preglasijo
neveljaven Render(HtmlTextWriter pisatelj)
{
writer.Write(“Vrednost Ime iz Resource File : “ + FirstName);
writer.Write(“Vrednost Priimek iz Resource File : “ + Priimek);
}
}
}
Veri nice article. In my blog I have similar article on how to use SPUtility.GetLocalizedString – http://dotnetfollower.com/wordpress/2011/05/the-usage-of-sputility-getlocalizedstring/