Kreye dosye Resous lè l sèvi avèk vizyèl Studio id
Kopi dosye a resous nan 12 ruch resous katab
GetLocalized metòd soti nan SPUtility li valè yo nan dosye resous
Sentaks:
SPUtility.GetLocalizedString(“$Resous:<<ResourceFileName,ResourceKeyName>>”, “<<ResourceFileName>>”, tan);
Egzanp:
SPUtility.GetLocalizedString(“$Resous:MyResources,Prénoms”, “MyResources”, tan);
Sous echantiyon:
lè l sèvi avèk Sistèm;
lè l sèvi avèk System.Runtime.InteropServices;
lè l sèvi avèk System.Web.UI;
lè l sèvi avèk System.Web.UI.WebControls;
lè l sèvi avèk System.Web.UI.WebControls.WebParts;
lè l sèvi avèk System.Xml.Serialization;
lè l sèvi avèk Microsoft.SharePoint;
lè l sèvi avèk Microsoft.SharePoint.WebControls;
lè l sèvi avèk Microsoft.SharePoint.WebPartPages;
lè l sèvi avèk Microsoft.SharePoint.Utilities;
Espas non ResourceFile
{
[Guid(“fc643df7-8836-41bf-913f-662ed57e659a”)]
piblik
klas
ResourceCollection : System.Web.UI.WebControls.WebParts.Web
{
fisèl Prénoms;
fisèl Prénoms;
piblik ResourceCollection()
{
}
pwoteje
pase sou desizyon
anile CreateChildControls()
{
baz.CreateChildControls();
wen lang = SPContext.Current.Web.Language;
Prénoms = SPUtility.GetLocalizedString(“$Resous:MyResources,Prénoms”, “MyResources”, tan);
Prénoms = SPUtility.GetLocalizedString(“$Resous:MyResources,Prénoms”, “MyResources”, tan);
}
pwoteje
pase sou desizyon
anile Rann(HtmlTextWriter ekriven)
{
writer.Write(“Valè de Prenon soti nan Resous File : “ + Prénoms);
writer.Write(“Valè de Siyati soti nan Resous File : “ + Prénoms);
}
}
}
Veri bèl atik. Nan blog mwen an mwen gen menm jan an atik sou kouman yo sèvi ak SPUtility.GetLocalizedString – http://dotnetfollower.com/wordpress/2011/05/the-usage-of-sputility-getlocalizedstring/