コード例 #1
0
        public IActionResult ExportXml(string id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageLanguages))
            {
                return(AccessDeniedView());
            }

            var language = _languageService.GetLanguageById(id);

            if (language == null)
            {
                //No language found with the specified id
                return(RedirectToAction("List"));
            }

            try
            {
                var xml = _localizationService.ExportResourcesToXml(language);
                return(File(Encoding.UTF8.GetBytes(xml), "application/xml", "language_pack.xml"));
            }
            catch (Exception exc)
            {
                ErrorNotification(exc);
                return(RedirectToAction("List"));
            }
        }
コード例 #2
0
        public ActionResult ExportXml(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageLanguages))
            {
                return(AccessDeniedView());
            }

            var language = _languageService.GetLanguageById(id);

            if (language == null)
            {
                //No language found with the specified id
                return(RedirectToAction("List"));
            }

            try
            {
                var xml = _localizationService.ExportResourcesToXml(language);
                return(new XmlDownloadResult(xml, "language_pack.xml"));
            }
            catch (Exception exc)
            {
                ErrorNotification(exc);
                return(RedirectToAction("List"));
            }
        }
コード例 #3
0
        public ActionResult ExportXml(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageLanguages))
            {
                return(AccessDeniedView());
            }

            var language = _languageService.GetLanguageById(id);

            if (language == null)
            {
                return(RedirectToAction("List"));
            }

            try
            {
                var xml = _localizationService.ExportResourcesToXml(language);
                return(new XmlDownloadResult(xml, "language-pack-{0}.xml".FormatInvariant(language.UniqueSeoCode)));
            }
            catch (Exception exc)
            {
                NotifyError(exc);
                return(RedirectToAction("List"));
            }
        }
コード例 #4
0
        public IActionResult ExportXml(string id)
        {
            var language = _languageService.GetLanguageById(id);

            if (language == null)
            {
                //No language found with the specified id
                return(RedirectToAction("List"));
            }

            try
            {
                var xml = _localizationService.ExportResourcesToXml(language);
                return(File(Encoding.UTF8.GetBytes(xml), "application/xml", "language_pack.xml"));
            }
            catch (Exception exc)
            {
                ErrorNotification(exc);
                return(RedirectToAction("List"));
            }
        }
コード例 #5
0
        public ActionResult ExportXml(long id)
        {
            var language = _languageService.GetLanguageById(id);

            if (language == null)
            {
                //No language found with the specified id
                return(RedirectToAction("List"));
            }

            try
            {
                var xml = _localizationService.ExportResourcesToXml(language);
                return(new XmlDownloadResult(xml, "language_pack.xml"));
            }
            catch (Exception exc)
            {
                ErrorNotification(exc);
                return(RedirectToAction("List"));
            }
        }
コード例 #6
0
 /// <summary>
 /// Export language resources to xml
 /// </summary>
 /// <param name="language">Language</param>
 /// <returns>Result in XML format</returns>
 public string ExportResourcesToXml(Language language)
 {
     return(_localizationService.ExportResourcesToXml(language));
 }