Example #1
0
        internal int fillTranslations(VSCulture sourceCulture, VSCulture targetCulture)
        {
            int found = 0;

            try
            {
                setToolbarStatusText(Properties.Resources.SearchingTranslations);

                List<ResourceDataBase> notexisting = sourceCulture.GetItemsNotExistingInCulture(targetCulture);

                var trans = new TranslationStorageManager();
                int process = 1;
                foreach (var data in notexisting)
                {
                    setToolbarStatusText(String.Format(Properties.Resources.SerachingTranslationsProcess, process, notexisting.Count()));

                    var result = trans.Search(data, targetCulture.Culture);

                    if (result.Count() > 0)
                    {
                        found++;
                        data.ResxFile.FileGroup.SetResourceData(data.Name, result.First().Text, targetCulture.Culture);
                    }
                    process++;
                }

                setToolbarStatusText(String.Format(Properties.Resources.SearchingTranslationsResult, found), 4000);
            }
            catch
            {
                resetToolbarStatusText();

                throw;
            }
            finally
            {
            }

            return found;
        }