/// <summary>
        ///
        /// </summary>
        /// <param name="db"></param>
        /// <param name="input"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        static public int ImportToSingleLanguageDBFromFile(SingleLanguageDB db, ILocalizationFile input,
                                                           LocalizationDB.ImportMode mode = LocalizationDB.ImportMode.kReplace)
        {
            // for now, all input file will be marked as english...
            if (!input.VerifyHeader("english"))
            {
                return(0);
            }
            int importCount = 0;
            int count       = input.CountLines();

            if (count > 0)
            {
                for (int i = 0; i < count; ++i)
                {
                    if (input.IsLineLocalizationData(i))
                    {
                        string tag  = "";
                        int    ver  = 0;
                        string data = "";
                        string rest = "";
                        input.GetData(i, ref tag, ref ver, ref data, ref rest);
                        if (db.Import(tag, ver, data, mode))
                        {
                            ++importCount;
                        }
                    }
                }
            }
            return(importCount);
        }
        /// <summary>
        /// Merge input into target.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="input"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        static public int MergeIn(SingleLanguageDB target, SingleLanguageDB input, LocalizationDB.ImportMode mode = LocalizationDB.ImportMode.kReplace)
        {
            int count = 0;

            foreach (var entry in input)
            {
                foreach (var kv in entry.Value)
                {
                    if (target.Import(entry.Key, kv.Key, kv.Value, mode))
                    {
                        ++count;
                    }
                }
            }
            return(count);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="translation"></param>
        static public void ScanExtraSpace(SingleLanguageDB translation)
        {
            List <Tuple <string, int, string> > toModify = new List <Tuple <string, int, string> >();

            foreach (var entry in translation)
            {
                foreach (var key in entry.Value.Keys)
                {
                    string newstr = ScanExtraSpace(entry.Value[key]);
                    if (newstr != entry.Value[key])
                    {
                        toModify.Add(new Tuple <string, int, string>(entry.Key, key, newstr));
                    }
                }
            }

            foreach (var it in toModify)
            {
                translation.Import(it.Item1, it.Item2, it.Item3, LocalizationDB.ImportMode.kReplace);
            }
        }