public IActionResult GetDynamicText(string name, string scope)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(View("Index"));
            }

            var model = m_dynamicTextService.GetDynamicText(name, scope);

            var directTranslation = m_localization.Translate(name, scope, LocTranslationSource.Database);

            var allDynamicTexts = m_dynamicTextService.GetAllDynamicText(name, scope);

            var result = new DynamicTextResult
            {
                Name = model?.Name,
                Text = model?.Text,
                DirectTranslation = directTranslation,
                AllDynamicTexts   = allDynamicTexts.Select(x => new CultureAndTextResult
                {
                    Culture = x.Culture,
                    Text    = x.Text,
                }).ToList(),
            };

            return(View("DynamicTextResult", result));
        }
Exemple #2
0
        public EditStaticTextViewModel GetText(string name, string scope)
        {
            //scope = m_dictionaryScopeResolver.GetDictionaryScope(scope);
            var staticText          = m_dynamicTextService.GetDynamicText(name, scope);
            var currentCultureLabel = m_localizationService.GetRequestCulture().NativeName;

            if (staticText == null)
            {
                return(new EditStaticTextViewModel
                {
                    Name = name,
                    Scope = scope,
                    IsRecordExists = false,
                    CultureNameLabel = currentCultureLabel,
                });
            }

            var staticTextViewModel = new EditStaticTextViewModel
            {
                Format                 = (StaticTextFormatType)staticText.Format,
                Name                   = staticText.Name,
                Scope                  = staticText.DictionaryScope,
                IsRecordExists         = true,
                LastModificationAuthor = staticText.ModificationUser,
                LastModificationTime   = staticText.ModificationTime,
                Text                   = staticText.Text,
                CultureNameLabel       = currentCultureLabel,
            };

            return(staticTextViewModel);
        }