Krijo skedarin burimor duke përdorur Visual Studio IDE
Kopjoni skedarin burimor në 12 dosje zgjua burimeve
GetLocalized method from SPUtility to read the values from resource file
Sintaksë:
SPUtility.GetLocalizedString(“$Burime:<<ResourceFileName,ResourceKeyName>>”, “<<ResourceFileName>>”, gjatë);
Shembull:
SPUtility.GetLocalizedString(“$Burime:MyResources,FirstName”, “MyResources”, gjatë);
Burimi mostrës:
using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.Utilities;
namespace ResourceFile
{
[Guid(“fc643df7-8836-41bf-913f-662ed57e659a”)]
publik
class
ResourceCollection : System.Web.UI.WebControls.WebParts.WebPart
{
varg FirstName;
varg Mbiemri;
publik ResourceCollection()
{
}
protected
override
pavlefshme CreateChildControls()
{
base.CreateChildControls();
uint lang = SPContext.Current.Web.Language;
FirstName = SPUtility.GetLocalizedString(“$Burime:MyResources,FirstName”, “MyResources”, gjatë);
LastName = SPUtility.GetLocalizedString(“$Burime:MyResources,Mbiemri”, “MyResources”, gjatë);
}
protected
override
pavlefshme Render(HtmlTextWriter writer)
{
writer.Write(“Value of First Name from Resource File : “ + FirstName);
writer.Write(“Value of Last Name from Resource File : “ + Mbiemri);
}
}
}
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/