Esempio n. 1
0
 /// <summary>
 /// Language-dependent separator between an entity and a sub-entity.
 /// </summary>
 public static String HierarchicalSeparator(Lang lang)
 {
     switch (lang.ShortName)
     {
         case "en": return ": ";
         case "fr": return " : ";
         default: return ": ";
     }
 }
        /// <summary>
        /// Langs parser
        /// Since other worksheet rows count is unknown at this stage, do not update progress bar inside the function
        /// </summary>
        private async Task ParseLangs()
        {
            if (_langs == null)
            {
                return;
            }

            foreach (var row in _langs)
            {
                Dictionary<int, object> cells = null;
                var rowCopy = row;
                await Task.Run(() =>
                {
                    cells = CellMapByRow(rowCopy, LangWorksheetName);
                });

                if (cells == null || cells.Count <= 0)
                {
                    continue;
                }

                var lang = new Lang
                {
                    LongName = CellContentWizard(cells, _worksheetColumns[LangWorksheetName]["long_name"]),
                    ShortName = CellContentWizard(cells, _worksheetColumns[LangWorksheetName]["short_name"]),
                    IsDefault = String.Compare(CellContentWizard(cells, _worksheetColumns[LangWorksheetName]["default"]).ToLower(), "yes", StringComparison.Ordinal) == 0,
                };

                // Short name is mandatory
                if (!String.IsNullOrEmpty(lang.ShortName))
                {
                    CatalogContext.Instance.Langs.Add(lang);
                }
            }
        }