/// ------------------------------------------------------------------------------------ public string GetNumberOfTranslatedItemsString() { int numStringsTranslated = EnabledManagers.Sum(lm => AllLeafNodes.Count(n => (n.GetHasModifications(false) || lm.StringCache.DoTranslationsExist(TgtLangId, n.Id)))); return($"{numStringsTranslated} of {AllLeafNodes.Count} Items Translated"); }
/// ------------------------------------------------------------------------------------ private IEnumerable <LocTreeNode <T> > GetLeafNodesOfNode(LocTreeNode <T> node) { foreach (var childNode in node.Nodes.Cast <LocTreeNode <T> >()) { if (AllLeafNodes.Contains(childNode)) { yield return(childNode); } else { foreach (var leafNode in GetLeafNodesOfNode(childNode)) { yield return(leafNode); } } } }
/// ------------------------------------------------------------------------------------ public bool Save() { if (_runInReadonlyMode) { return(false); } var stringsLocalized = false; foreach (var node in AllLeafNodes.Where(n => n.SavedTranslationInfo.Count > 0)) { stringsLocalized = true; foreach (var locInfo in node.SavedTranslationInfo.Values) { node.Manager.StringCache.UpdateLocalizedInfo(locInfo); } // Update each object with the specified id, with the localized string(s). foreach (var component in GetComponentsForId(node.Manager, node.Id).Where(o => o != null)) { node.Manager.ApplyLocalization(component); } } foreach (var lm in LocalizationManagerInternal <T> .LoadedManagers.Values) { lm.PrepareToCustomizeLocalizations(); lm.SaveIfDirty(_modifiedLanguages); // If saving fails, the LocalizationManagerInternal will record the problem . _runInReadonlyMode |= !lm.CanCustomizeLocalizations; } return(stringsLocalized); }
/// ------------------------------------------------------------------------------------ public bool GetIsDirty() { return(AllLeafNodes.Any(n => n.GetHasModifications(true))); }