public List <MTCloudLanguage> GetMTCloudLanguages(MappedLanguage mappedLanguage, CultureInfo cultureInfo)
        {
            var languageMappings = new List <MTCloudLanguage>();

            if (mappedLanguage != null)
            {
                languageMappings.Add(new MTCloudLanguage
                {
                    CodeName = mappedLanguage.MTCode,
                    IsLocale = false,
                    Flag     = SetLanguageFlag(cultureInfo)
                });

                if (!string.IsNullOrEmpty(mappedLanguage.MTCodeLocale))
                {
                    languageMappings.Add(new MTCloudLanguage
                    {
                        CodeName = mappedLanguage.MTCodeLocale,
                        IsLocale = true,
                        Flag     = SetLanguageFlag(cultureInfo)
                    });
                }
            }

            return(languageMappings);
        }
Exemple #2
0
        private static List <MappedLanguage> GetLanguages(IEnumerable <ExcelRow> excelRows)
        {
            var languages = new List <MappedLanguage>();

            foreach (var row in excelRows)
            {
                var language = new MappedLanguage
                {
                    Index = row.Index
                };

                foreach (var cell in row.Cells)
                {
                    switch (cell.Column.Index)
                    {
                    case 0:
                        language.LanguageCode = cell.Value;
                        break;

                    case 1:
                        language.LanguageName = cell.Value;
                        break;

                    case 2:
                        language.LanguageRegion = cell.Value;
                        break;

                    case 3:
                        language.MappedCode = cell.Value;
                        break;

                    case 4:
                        language.CustomDisplayName = cell.Value;
                        break;
                    }
                }

                languages.Add(language);
            }

            return(languages);
        }