Sortu Baliabideen fitxategia Visual Studio IDErekin
Kopiatu baliabide-fitxategia sartu 12 hive errekurtsoen karpeta
GetLocalized method from SPUtility to read the values from resource file
Sintaxia:
SPUtility.GetLocalizedString(“$Baliabideak:<<ResourceFileName,ResourceKeyName>>”, “<<ResourceFileName>>”, bakarrik);
Adibidea:
SPUtility.GetLocalizedString(“$Baliabideak:MyResources,FirstName”, “MyResources”, bakarrik);
Sample Iturria:
erabiliz System;
erabiliz System.Runtime.InteropServices;
erabiliz System.Web.UI;
erabiliz System.Web.UI.WebControls;
erabiliz System.Web.UI.WebControls.WebParts;
erabiliz System.Xml.Serialization;
erabiliz Microsoft.SharePoint;
erabiliz Microsoft.SharePoint.WebControls;
erabiliz Microsoft.SharePoint.WebPartPages;
erabiliz Microsoft.SharePoint.Utilities;
namespace ResourceFile
{
[Guid(“fc643df7-8836-41bf-913f-662ed57e659a”)]
publikoa
class
ResourceCollection : System.Web.UI.WebControls.WebParts.Web
{
katea FirstName;
katea LastName;
publikoa ResourceCollection()
{
}
protected
override
void CreateChildControls()
{
base.CreateChildControls();
uint lang = SPContext.Current.Web.Language;
FirstName = SPUtility.GetLocalizedString(“$Baliabideak:MyResources,FirstName”, “MyResources”, bakarrik);
LastName = SPUtility.GetLocalizedString(“$Baliabideak:MyResources,LastName”, “MyResources”, bakarrik);
}
protected
override
void Render(HtmlTextWriter writer)
{
writer.Write(“Value of First Name from Resource File : “ + FirstName);
writer.Write(“Value of Last Name from Resource File : “ + LastName);
}
}
}
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/