Hello,
You can use something like this,
For Installing resource string while install method :-
protected virtual void InstallLocaleResources()
{
var language = _languageRepository.Table.Single(l => l.Name == "English");
foreach (var filePath in System.IO.Directory.EnumerateFiles(_webHelper.MapPath("~/Plugins/PluginName/Localization/Installation"), "ResourceString.xml", SearchOption.TopDirectoryOnly))
{
var localesXml = File.ReadAllText(filePath);
var localizationService = EngineContext.Current.Resolve<ILocalizationService>();
localizationService.ImportResourcesFromXml(language, localesXml);
}
}
For UnInstalling resource string while uninstall method :-
Use same function but instead of calling
localizationService.ImportResourcesFromXml
to load the xml string into a XML DOM object.
Then loop through all the LocaleResource elements, and with their Name attribute,
After call the usual
this.DeletePluginLocaleResource("pass-Name-here")
plugin method which commonly use.