public static LocalizedAssemblyChanges GetAssemblyChanges(ITranslator translator, LocalizedAssembly target, LocalizedAssembly master, List <LocalizedAssembly> support, Lite <RoleEntity> role, string @namespace, out int totalTypes) { var types = GetMergeChanges(target, master, support); if (role != null) { types = types.Where(t => TranslationLogic.GetCountNotLocalizedMemebers(role, t.Type.Assembly.Culture, t.Type.Type) > 0).ToList(); } if (@namespace != null) { types = types.Where(t => t.Type.Type.Namespace == @namespace).ToList(); } totalTypes = types.Count; if (types.Sum(a => a.TotalOriginalLength()) > MaxTotalSyncCharacters) { types = types.GroupsOf(a => a.TotalOriginalLength(), MaxTotalSyncCharacters).First().ToList(); } var result = Translate(translator, target, types); return(result); }
public static List <TranslatedTypeSummary> TranslationInstancesStatus() { var cultures = TranslationLogic.CurrentCultureInfos(DefaultCulture); return((from type in TranslateableRoutes.Keys from ci in cultures select new TranslatedTypeSummary { Type = type, CultureInfo = ci, State = ci.IsNeutralCulture && ci.Name != DefaultCulture.Name ? GetState(type, ci) : null, }).ToList()); }
public static TypeInstancesChanges GetTypeInstanceChangesTranslated(ITranslator translator, Type type, CultureInfo targetCulture, out int totalInstances) { var cultures = TranslationLogic.CurrentCultureInfos(TranslatedInstanceLogic.DefaultCulture); cultures.Remove(targetCulture); var instances = TranslatedInstanceLogic.GetInstanceChanges(type, targetCulture, cultures); totalInstances = instances.Count; if (instances.Sum(a => a.TotalOriginalLength()) > MaxTotalSyncCharacters) { instances = instances.GroupsOf(a => a.TotalOriginalLength(), MaxTotalSyncCharacters).First().ToList(); } return(TranslateInstances(translator, type, targetCulture, instances)); }