Example #1
0
        /// <summary>
        ///     Adds entries to <paramref name="dictionary" />, based on the languages in <paramref name="excelCells" />
        /// </summary>
        /// <exception cref="CultureNotFoundException">
        ///     Thrown, if one of the cells of the header rows in <paramref name="excelCells" /> is not recognized as
        ///     a language.
        /// </exception>
        public static void FillSubDictionaries(Dictionary <CultureInfo, Dictionary <string, string> > dictionary,
                                               object[,] excelCells, int maxColumn, int numberOfKeyParts)
        {
            for (var langIndex = numberOfKeyParts + 1; langIndex <= maxColumn; langIndex++)
            {
                var lang = CultureInfoUtil.GetCultureInfo(ExcelCellToString(excelCells[1, langIndex]),
                                                          true);

                if (!dictionary.ContainsKey(lang))
                {
                    dictionary.Add(lang, new Dictionary <string, string>());
                }
            }
        }
Example #2
0
        /// <summary>
        ///     Returns a dictionary that maps <see cref="CultureInfo" /> objects to their column of
        ///     <paramref name="excelCells" />, in which they appear.
        /// </summary>
        /// <exception cref="CultureNotFoundException">
        ///     Thrown, if one of the cells of the header rows in <paramref name="excelCells" /> is not recognized as
        ///     a language.
        /// </exception>
        public static Dictionary <CultureInfo, int> GetLanguageColumnsLookupTable(object[,] excelCells,
                                                                                  int numberOfKeyParts)
        {
            var lookupTable = new Dictionary <CultureInfo, int>();
            var maxColumn   = excelCells.GetUpperBound(1);

            for (var column = GetNumberOfKeyParts(excelCells) + 1; column <= maxColumn; column++)
            {
                var culture = CultureInfoUtil.GetCultureInfo(
                    ExcelCellToString(excelCells[1, column]), true);
                lookupTable.Add(culture, column);
            }

            return(lookupTable);
        }