I have a multilingual site with single node approach. Requirement is simple, need to create a task to fetch all items and generate a XML file.
I have created a Sitecore scheduled job and command and implemented the logic for generating XML in C#. It is generating the XML file as expected. But the only issue is it is not generating for different languages in the site, rather than its generating only for single language and that's English.
For example I have a node with two languages English and French. I created a scheduled job and written a logic to fetch all item names in the node and generates an XML file. But I need two separate XML file. One must holds the information in English version and another must be in French version.
Things I have tried:
Created same task in both English and French version and tried setting it in different interval time.
Created same command in both English and French version.
..
public void Hook(Item[] items, Sitecore.Tasks.CommandItem command, Sitecore.Tasks.ScheduleItem schedule)
{
var appSettings = new FetchAppSetting();
using (new DatabaseSwitcher(Sitecore.Configuration.Factory.GetDatabase("web")))
{
if (command.ID.ToString() == appSettings.Config.CommandId)
{
Settings SettingsItem = null; SettingsItem = new Settings(commandId);
//..and my logic for generating XML goes here..
}
}
}
Please do let me know if I'm making any mistakes on the above steps or give your suggestions to make it proper if I'm wrong.
Thanks in advance.