public virtual TitleDescriptionObjectTranslation GetTranslation(Int32 idUserLanguage, Int32 idDefaultLanguage, Boolean firstIsMulti, Boolean useFirstOccurence) { TitleDescriptionObjectTranslation translation = null; if (Translations == null || Translations.Any()) { translation = Translations.Where(t => t.IdLanguage == idUserLanguage).FirstOrDefault().Translation; } if (translation == null && DefaultTranslation.IsValid() && firstIsMulti) { translation = DefaultTranslation; } if (translation == null && Translations.Any()) { translation = Translations.Where(t => t.IdLanguage == idDefaultLanguage).FirstOrDefault().Translation; } if (translation == null && Translations.Any() && useFirstOccurence) { translation = Translations.FirstOrDefault().Translation; } return((translation == null) ? new TitleDescriptionObjectTranslation() { Title = Id.ToString() } : translation); }
internal bool TypeIsWrapped(Type type) { if (type == typeof(NodeList)) { Console.WriteLine("BREAK!!"); } if (type == typeof(Map)) { Console.WriteLine("BREAK!!"); } if (type == null) { throw new ArgumentNullException("type"); } if (type.FullName == null) { throw new ArgumentException("type"); } bool translationOk = Translations.Any(trans => type.FullName.StartsWith(trans.Key)); return /* type.Assembly == TargetAssembly && */ (translationOk && !type.IsNested /* && !type.IsInterface */ && !type.IsArray); }
private bool HasTranslation() { if (Translations == null || Translations.Count < 1) { return(false); } return(!Translations.Any(x => string.IsNullOrWhiteSpace(x.Translation))); }
public virtual String GetTranslation(String userLanguageCode, Int32 idDefaultLanguage) { String translation = (Translations == null || (Translations.Any() && !Translations.Where(t => t.Deleted == BaseStatusDeleted.None).Any())) ? ToolTip : (Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.LanguageCode == userLanguageCode).Any()) ? Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.LanguageCode == userLanguageCode).Select(t => t.ToolTip).FirstOrDefault() : Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idDefaultLanguage).Select(t => t.ToolTip).FirstOrDefault(); if (String.IsNullOrEmpty(translation)) { translation = ToolTip; } return(translation); }
public ItemObjectTranslation GetTranslation(String userLanguageCode, Int32 idDefaultLanguage) { ItemObjectTranslation translation = (Translations == null || !Translations.Any()) ? DefaultTranslation : (Translations.Where(t => t.LanguageCode == userLanguageCode).Any()) ? Translations.Where(t => t.LanguageCode == userLanguageCode).Select(t => t.Translation).FirstOrDefault() : Translations.Where(t => t.IdLanguage == idDefaultLanguage).Select(t => t.Translation).FirstOrDefault(); if (translation == null) { translation = DefaultTranslation; } return(translation); }
public String GetName(Int32 idUserLanguage, Int32 idDefaultLanguage) { String name = (Translations == null || !Translations.Any()) ? DefaultTranslation.Name : (Translations.Where(t => t.IdLanguage == idUserLanguage).Any()) ? Translations.Where(t => t.IdLanguage == idUserLanguage).Select(t => t.Translation.Name).FirstOrDefault() : Translations.Where(t => t.IdLanguage == idDefaultLanguage).Select(t => t.Translation.Name).FirstOrDefault(); if (String.IsNullOrEmpty(name)) { name = DefaultTranslation.Name; } return(name); }
public virtual String GetLowerTitle(Int32 idUserLanguage, Int32 idDefaultLanguage) { String name = (Translations == null || (Translations.Any() && !Translations.Where(t => t.Deleted == BaseStatusDeleted.None).Any())) ? DefaultTranslation.Title : (Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idUserLanguage).Any()) ? Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idUserLanguage).Select(t => t.Translation.Title).FirstOrDefault() : Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idDefaultLanguage).Select(t => t.Translation.Title).FirstOrDefault(); if (String.IsNullOrEmpty(name)) { name = DefaultTranslation.Title; } return(String.IsNullOrEmpty(name) ? "" : name.ToLower()); }
public ItemObjectTranslation GetTranslation(String userLanguageCode, Int32 idDefaultLanguage) { ItemObjectTranslation translation = (Translations == null || (Translations.Any() && !Translations.Where(t => t.Deleted == BaseStatusDeleted.None).Any())) ? DefaultTranslation : (Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.LanguageCode == userLanguageCode).Any()) ? Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.LanguageCode == userLanguageCode).Select(t => t.Translation).FirstOrDefault() : Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idDefaultLanguage).Select(t => t.Translation).FirstOrDefault(); if (translation == null || !translation.IsValid()) { translation = DefaultTranslation; } return(translation); }
private string GetMessageTranslation(Problem problem, string Language) { if (Translations.Any(x => x.Code == problem.ErrorCode.Value)) { return(Translations.FirstOrDefault(x => x.Code == problem.ErrorCode.Value && x.Language == Language).Text); } else { return(problem.ErrorCode.Value); } }
private bool IsCultureNameMatched() { if (!_configuration.ConstrainTranslatedRoutesByCurrentUICulture) { return(true); } // If no translations are available, then obviously the answer is yes. if (!_configuration.TranslationProviders.Any()) { return(true); } var currentUICultureName = Thread.CurrentThread.CurrentUICulture.Name; var currentUINeutralCultureName = currentUICultureName.Split('-').First(); // If this is a translated route: if (DefaultRoute != null) { // Match if the current UI culture matches the culture name of this route. if (currentUICultureName.ValueEquals(CultureName)) { return(true); } // Match if the culture name is neutral and no translation exists for the specific culture. if (CultureName.Split('-').Length == 1 && currentUINeutralCultureName == CultureName && !DefaultRoute.Translations.Any(t => t.CultureName.ValueEquals(currentUICultureName))) { return(true); } } else { // If this is a default route: // Match if this route has no translations. if (!Translations.Any()) { return(true); } // Match if this route has no translations for the neutral current UI culture. if (!Translations.Any(t => t.CultureName == currentUINeutralCultureName)) { return(true); } } // Otherwise, don't match. return(false); }
public virtual Boolean IsEmptyForLanguage(Int32 idLanguage) { if (idLanguage <= 0) { return(String.IsNullOrEmpty(DefaultTranslation.Title)); } else { return(Translations == null || !Translations.Any() || (!Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idLanguage && !String.IsNullOrEmpty(t.Translation.Title)).Any())); } }
public virtual liteTagTranslation GetTranslation(Int32 idUserLanguage, Int32 idDefaultLanguage, String dLanguageName, String dLanguageCode) { liteTagTranslation translation = (Translations == null || (Translations.Any() && !Translations.Where(t => t.Deleted == BaseStatusDeleted.None).Any())) ? null : (Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idUserLanguage).Any()) ? Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idUserLanguage).FirstOrDefault() : Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idDefaultLanguage).FirstOrDefault(); if (translation == null) { translation = new liteTagTranslation() { IdLanguage = 0, LanguageCode = dLanguageCode, LanguageName = dLanguageName, Translation = DefaultTranslation } } ; return(translation); }
private ItemTranslation GetTranslation(Int32 idLanguage, Int32 idDefault) { ItemTranslation translation = GetTranslation(idLanguage); if (translation == null) { translation = GetTranslation(idDefault); if (translation == null && Translations.Any()) { translation = Translations.FirstOrDefault(); } } return(translation); }
public virtual object Clone() { liteTileItem clone = new liteTileItem(); clone.Type = Type; clone.CssClass = CssClass; clone.ToolTip = ToolTip; clone.NavigateUrl = NavigateUrl; if (Translations.Any()) { clone.Translations = Translations.Where(t => t.Deleted == BaseStatusDeleted.None).Select(t => (liteTileItemTranslation)t.Clone()).ToList(); } clone.Deleted = Deleted; clone.Id = Id; return(clone); }
private VirtualPathData GetTranslatedVirtualPath(VirtualPathData virtualPathData, RequestContext requestContext, RouteValueDictionary values) { if (Translations == null || !Translations.Any()) { return(virtualPathData); } var currentCultureName = Thread.CurrentThread.CurrentUICulture.Name; // Try and get the language-culture translation, then fall back to language translation var translation = Translations.FirstOrDefault(t => t.CultureName == currentCultureName) ?? Translations.FirstOrDefault(t => currentCultureName.StartsWith(t.CultureName)); if (translation == null) { return(virtualPathData); } return(translation.GetVirtualPath(requestContext, values)); }
public virtual String GetFirstLetter(Int32 idLanguage) { String title = ""; if (idLanguage <= 0) { title = DefaultTranslation.Title; } else { title = (Translations == null || (Translations.Any() && !Translations.Where(t => t.Deleted == BaseStatusDeleted.None).Any())) ? "" : Translations.Where(t => t.IdLanguage == idLanguage).Select(t => t.Translation.Title).FirstOrDefault(); } if (String.IsNullOrEmpty(title)) { return(""); } else { return(title[0].ToString().ToLower()); } }
public virtual String GetTranslation(Int32 idUserLanguage, Int32 idDefaultLanguage, Boolean firstIsMulti, Boolean useFirstOccurence) { String translation = ""; if (Translations == null || Translations.Any()) { translation = Translations.Where(t => t.IdLanguage == idUserLanguage).FirstOrDefault().ToolTip; } if (String.IsNullOrEmpty(translation) && !String.IsNullOrEmpty(ToolTip) && firstIsMulti) { translation = ToolTip; } if (String.IsNullOrEmpty(translation) && Translations.Any()) { translation = Translations.Where(t => t.IdLanguage == idDefaultLanguage).FirstOrDefault().ToolTip; } if (String.IsNullOrEmpty(translation) && Translations.Any() && useFirstOccurence) { translation = Translations.FirstOrDefault().ToolTip; } return((String.IsNullOrEmpty(translation)) ? Id.ToString() : translation); }
public lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation GetTranslation(Int32 idUserLanguage, Int32 idDefaultLanguage, Boolean firstIsMulti, Boolean useFirstOccurence) { lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation translation = null; if (Translations != null && Translations.Any(t => t.IdLanguage == idUserLanguage)) { translation = Translations.Where(t => t.IdLanguage == idUserLanguage).FirstOrDefault().Translation; } if (translation == null && DefaultTranslation.IsValid() && firstIsMulti) { translation = DefaultTranslation; } if (translation == null && Translations.Any()) { translation = Translations.Where(t => t.IdLanguage == idDefaultLanguage).FirstOrDefault().Translation; } if (translation == null && Translations.Any() && useFirstOccurence) { translation = Translations.FirstOrDefault().Translation; } return((translation == null) ? new lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation() { Name = Id.ToString() } : translation); }
public bool IsTranslationUnique(TranslationEntity translationToCheck) { translationToCheck.NotNull("translationToCheck"); return(Translations.Any(t => t.Translation == translationToCheck.Translation)); }
public virtual lm.Comol.Core.DomainModel.Languages.TitleDescriptionObjectTranslation GetTranslation(String userLanguageCode, Int32 idDefaultLanguage) { lm.Comol.Core.DomainModel.Languages.TitleDescriptionObjectTranslation translation = (Translations == null || (Translations.Any() && !Translations.Where(t => t.Deleted == BaseStatusDeleted.None).Any())) ? DefaultTranslation : (Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.LanguageCode == userLanguageCode).Any()) ? Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.LanguageCode == userLanguageCode).Select(t => t.Translation).FirstOrDefault() : Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idDefaultLanguage).Select(t => t.Translation).FirstOrDefault(); if (translation == null || !translation.IsValid()) { translation = DefaultTranslation; } return(translation); }
public virtual Boolean IsValid() { return(Translations != null && Translations.Any() && ((Channel != lm.Comol.Core.Notification.Domain.NotificationChannel.None && Channel != lm.Comol.Core.Notification.Domain.NotificationChannel.Mail) || (MailSettings != null && Channel == lm.Comol.Core.Notification.Domain.NotificationChannel.Mail))); }
private bool CanClear(object arg) { return(!string.IsNullOrWhiteSpace(NewWord) || (Translations.Count > 0 && Translations.Any(x => !string.IsNullOrWhiteSpace(x.Translation)))); }
public virtual TitleDescriptionObjectTranslation GetTranslation(Int32 idUserLanguage, Int32 idDefaultLanguage) { TitleDescriptionObjectTranslation translation = (Translations == null || (Translations.Any() && !Translations.Where(t => t.Deleted == BaseStatusDeleted.None).Any())) ? DefaultTranslation : (Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idUserLanguage).Any()) ? Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idUserLanguage).Select(t => t.Translation).FirstOrDefault() : Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idDefaultLanguage).Select(t => t.Translation).FirstOrDefault(); if (translation == null || !translation.IsValid()) { translation = DefaultTranslation; } return(translation); }
public lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation GetTranslation(Int32 idUserLanguage, Int32 idDefaultLanguage) { lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation translation = (Translations == null || (Translations.Any() && !Translations.Where(t => t.Deleted == BaseStatusDeleted.None).Any())) ? DefaultTranslation : (Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idUserLanguage).Any()) ? Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idUserLanguage).Select(t => t.Translation).FirstOrDefault() : Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idDefaultLanguage).Select(t => t.Translation).FirstOrDefault(); if (translation == null) { translation = DefaultTranslation; } return(translation); }