public ActionResult Index() { var model = new LocalizationEditorViewModel { Categories = _persister.GetLocalizations(), Languages = _persister.GetEnabledLanguages(), Versions = _persister.GetTranslationFileVersions(), PowertoolsMode = !Settings.AutoPopulated.DisablePowertoolsMode }; return(View(ModuleUtil.PathTo("Views/LocalizationEditor/Index.cshtml"), model)); }
public void SaveLocalizations(LocalizationEditorViewModel model) { var xml = new XmlDocument(); // Ensure root node is created xml.CreateXPath(LanguagesXPath); foreach (var translation in model.Categories.SelectMany(category => category.Translations)) { foreach (var dictionary in translation.Translations) { if (!string.IsNullOrWhiteSpace(dictionary.Value)) { SetTranslation(xml, translation.Key, dictionary.Key, dictionary.Value); } } } AddLanguageNames(xml); SaveXml(xml, _translationFilePath); LocalizationsUpdatedEventHandler.RaiseLocalizationsUpdatedEvent(); }
public ActionResult Save(LocalizationEditorViewModel model) { _persister.SaveLocalizations(model); return(RedirectToAction("Index")); }