In my site they have configured in 5 sites. SiteName: A,B,C,D,E.
I want to have the ability to customise these two pieces of text by site using a site specific resource (localization) string for each text field.
These resource strings should be configurable by an Admin on Kentico, and should be able to be configured by each site.
The current names of these strings in Kentico are “A.Checkout.EmailTitle” and “A.Checkout.EmailDescription” for the Title and Description respectively.
I using below code:
public string GetPerSiteResourceString(string name, string site = "")
{
if (string.IsNullOrEmpty(site))
{
site = SiteContext.CurrentSiteName;
}
var fullname = $"{site}.{name}";
var perSiteStringInfo = ResourceStringInfoProvider.GetResourceStringInfo(fullname, LocalizationContext.CurrentCulture.CultureCode);
if (perSiteStringInfo != null && perSiteStringInfo.StringID > 0)
{
return perSiteStringInfo.TranslationText;
}
return ResHelper.GetString(name, LocalizationContext.CurrentCulture.CultureCode);
}
Title = resources.GetPerSiteResourceString("Kadena.Checkout.EmailTitle"), Description = resources.GetPerSiteResourceString("Kadena.Checkout.EmailDescription")