Kujenga Rasilimali faili kutumia Visual Studio IDE
Nakala faili rasilimali katika 12 mizinga ya rasilimali folder
GetLocalized njia kutoka SPUtility kusoma kutoka faili maadili rasilimali
Syntax:
SPUtility.GetLocalizedString(“$Rasilimali:<<ResourceFileName,ResourceKeyName>>”, “<<ResourceFileName>>”, muda mrefu);
Mfano:
SPUtility.GetLocalizedString(“$Rasilimali:MyResources,FIRSTNAME”, “MyResources”, muda mrefu);
Chanzo sampuli:
kutumia System;
kutumia System.Runtime.InteropServices;
kutumia System.Web.UI;
kutumia System.Web.UI.WebControls;
kutumia System.Web.UI.WebControls.WebParts;
kutumia System.Xml.Serialization;
kutumia Microsoft.SharePoint;
kutumia Microsoft.SharePoint.WebControls;
kutumia Microsoft.SharePoint.WebPartPages;
kutumia Microsoft.SharePoint.Utilities;
namespace ResourceFile
{
[Guid(“fc643df7-8836-41bf-913f-662ed57e659a”)]
umma
darasa
ResourceCollection : System.Web.UI.WebControls.WebParts.WebPart
{
string FIRSTNAME;
string Jina la familia;
umma ResourceCollection()
{
}
kulindwa
override
utupu CreateChildControls()
{
msingi.CreateChildControls();
uint lang = SPContext.Current.Web.Language;
FIRSTNAME = SPUtility.GetLocalizedString(“$Rasilimali:MyResources,FIRSTNAME”, “MyResources”, muda mrefu);
LastName = SPUtility.GetLocalizedString(“$Rasilimali:MyResources,Jina la familia”, “MyResources”, muda mrefu);
}
kulindwa
override
utupu Atatoa(HtmlTextWriter mwandishi)
{
writer.Write(“Thamani ya Jina la kwanza kutoka nyenzo ya faili : “ + FIRSTNAME);
writer.Write(“Thamani ya Jina la Mwisho kutoka nyenzo ya faili : “ + Jina la familia);
}
}
}
Veri Makala nzuri. Katika blog yangu nina makala sawa juu ya jinsi ya kutumia SPUtility.GetLocalizedString – http://dotnetfollower.com/wordpress/2011/05/the-usage-of-sputility-getlocalizedstring/