internal void fillTranslations() { if (CheckDatabase()) { try { setToolbarStatusText(Properties.Resources.SearchingTranslations); int process = 1; int found = 0; int max = CurrentSolution.Cultures.Count * (CurrentSolution.Cultures.Count - 1); var trans = new TranslationStorageManager(); foreach (VSCulture sourceCulture in CurrentSolution.Cultures.Values) { foreach (VSCulture targetCulture in CurrentSolution.Cultures.Values.Except(new VSCulture[] { sourceCulture })) { setToolbarStatusText(String.Format(Properties.Resources.SerachingTranslationsProcess, process, max)); List<ResourceDataBase> notexisting = sourceCulture.GetItemsNotExistingInCulture(targetCulture); foreach (var data in notexisting) { var result = trans.Search(data, targetCulture.Culture); if (result.Count() > 0) { found++; data.ResxFile.FileGroup.SetResourceData(data.Name, result.First().Text, targetCulture.Culture); } } process++; } } if (found > 0) this.solutionTree1.RefreshAnalysis(); setToolbarStatusText(String.Format(Properties.Resources.SearchingTranslationsResult, found), 4000); } catch { resetToolbarStatusText(); throw; } finally { } } }
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; }