Esempio n. 1
0
        public IList <IEntryLanguage> CreateEntryLanguages(ExcelTerm excelTerm)
        {
            var result = new List <IEntryLanguage>();

            var sourceEntryLanguage = new ExcelEntryLanguage
            {
                Locale   = excelTerm.SourceCulture,
                Name     = excelTerm.SourceCulture.EnglishName,
                Terms    = CreateEntryTerms(excelTerm.Source),
                Fields   = new List <IEntryField>(),
                IsSource = true
            };

            result.Add(sourceEntryLanguage);

            if (excelTerm.Target != null)
            {
                var targetEntryLanguage = new ExcelEntryLanguage
                {
                    Locale   = excelTerm.TargetCulture,
                    Name     = excelTerm.TargetCulture.EnglishName,
                    Terms    = CreateEntryTerms(excelTerm.Target, excelTerm.Approved),
                    Fields   = new List <IEntryField>(),
                    IsSource = false
                };
                result.Add(targetEntryLanguage);
            }
            return(result);
        }
Esempio n. 2
0
        public static string[] GetTermCustomFields(this ExcelEntryLanguage entryLanguages)
        {
            var result = new List <string>();

            foreach (var term in entryLanguages.Terms)
            {
                result.AddRange(term.Fields.Select(x => x.Value));
            }

            return(result.ToArray());
        }
Esempio n. 3
0
        private void sourceListView_CellEditFinished(object sender, CellEditEventArgs e)
        {
            var textBox = e.Control as CustomTabTextBox;

            if (textBox != null)
            {
                textBox.OnTabPressed -= TextBox_OnTabPressed;
            }
            var termName  = e.NewValue as string;
            var entryTerm = e.RowObject as ExcelEntry;

            if (entryTerm == null)
            {
                return;
            }


            var sourceEntryTerms    = _transformerService.CreateEntryTerms(termName);
            var sourceEntryLanguage = entryTerm.Languages.Cast <ExcelEntryLanguage>().FirstOrDefault(x => x.IsSource);

            if (sourceEntryLanguage == null)
            {
                var newSourceEntryLanguage = new ExcelEntryLanguage
                {
                    Locale   = _providerSettings.SourceLanguage,
                    Name     = _providerSettings.SourceLanguage.EnglishName,
                    Terms    = sourceEntryTerms,
                    Fields   = new List <IEntryField>(),
                    IsSource = true
                };
                entryTerm.Languages.Add(newSourceEntryLanguage);
            }
            else
            {
                sourceEntryLanguage.Terms = sourceEntryTerms;
            }
        }