当前位置: 首页>>代码示例>>C#>>正文


C# Localization.LocalizedString类代码示例

本文整理汇总了C#中Orchard.Localization.LocalizedString的典型用法代码示例。如果您正苦于以下问题:C# LocalizedString类的具体用法?C# LocalizedString怎么用?C# LocalizedString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LocalizedString类属于Orchard.Localization命名空间,在下文中一共展示了LocalizedString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnActionExecuting

        public void OnActionExecuting(ActionExecutingContext filterContext) {
            var messages = Convert.ToString(filterContext.Controller.TempData[TempDataMessages]);
            if (String.IsNullOrEmpty(messages))
                return;

            var messageEntries = new List<NotifyEntry>();
            foreach (var line in messages.Split(new[] { System.Environment.NewLine + "-" + System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) {
                var delimiterIndex = line.IndexOf(':');
                if (delimiterIndex != -1) {
                    var type = (NotifyType)Enum.Parse(typeof(NotifyType), line.Substring(0, delimiterIndex));
                    var message = new LocalizedString(line.Substring(delimiterIndex + 1));
                    if (!messageEntries.Any(ne => ne.Message.TextHint == message.TextHint)) {
                        messageEntries.Add(new NotifyEntry {
                            Type = type,
                            Message = message
                        });
                    }
                }
                else {
                    var message = new LocalizedString(line.Substring(delimiterIndex + 1));
                    if (!messageEntries.Any(ne => ne.Message.TextHint == message.TextHint)) {
                        messageEntries.Add(new NotifyEntry {
                            Type = NotifyType.Information,
                            Message = message
                        });
                    }
                }
            }

            if (!messageEntries.Any())
                return;

            // Make the notifications available for the rest of the current request.
            filterContext.HttpContext.Items[TempDataMessages] = messageEntries;
        }
开发者ID:mikmakcar,项目名称:orchard_fork_learning,代码行数:35,代码来源:NotifyFilter.cs

示例2: GraphDescriptor

 public GraphDescriptor(string name, LocalizedString displayName, IEnumerable<string> contentTypes, Func<IGraphDescriptor, IGraphServices> servicesFactory)
 {
     Name = name;
     DisplayName = displayName;
     ContentTypes = contentTypes;
     _graphServicesField = new Lazy<IGraphServices>(() => servicesFactory(this));
 }
开发者ID:Lombiq,项目名称:Associativy-Core,代码行数:7,代码来源:GraphDescriptor.cs

示例3: Authorize

        public new bool Authorize(Permission permission, IContent content, LocalizedString message) {
            var authorizerMessage = new AuthorizerMessage {PermissionName = permission.Name};

            if (content != null)
            {
                authorizerMessage.ContentId = content.Id;
                authorizerMessage.ContentType = content.ContentItem.ContentType;
                authorizerMessage.ContentName = content.GetContentName();
            }

            return _performanceMonitor.PublishTimedAction(() =>
            {
                if (permission == StandardPermissions.AccessFrontEnd)
                {
                    return true;
                }

                return base.Authorize(permission, content, message);
            }, (r, t) => { 
                authorizerMessage.Duration = t.Duration;
                authorizerMessage.UserIsAuthorized = r;

                return authorizerMessage;
            }, TimelineCategories.Authorization, "Authorize", permission.Name).ActionResult;
        }
开发者ID:pszmyd,项目名称:Glimpse.Orchard,代码行数:25,代码来源:GlimpseAuthorizer.cs

示例4: Add

 public BindingBuilder Add(PropertyInfo property, LocalizedString display, LocalizedString description) {
     _memberBindings.Add( new BindingItem{
         Property = property,
         DisplayName = display,
         Description = description
     });
     return this;
 }
开发者ID:RasterImage,项目名称:Orchard,代码行数:8,代码来源:IMemberBindingProvider.cs

示例5: For

 public DescribeSortCriterionFor For(string category, LocalizedString name, LocalizedString description) {
     DescribeSortCriterionFor describeFor;
     if (!_describes.TryGetValue(category, out describeFor)) {
         describeFor = new DescribeSortCriterionFor(category, name, description);
         _describes[category] = describeFor;
     }
     return describeFor;
 }
开发者ID:anycall,项目名称:Orchard,代码行数:8,代码来源:DescribeSortCriteriaContext.cs

示例6: For

 public DescribeFor For(string category, LocalizedString name) {
     DescribeFor describeFor;
     if (!_describes.TryGetValue(category, out describeFor)) {
         describeFor = new DescribeFor(category, name);
         _describes[category] = describeFor;
     }
     return describeFor;
 }
开发者ID:RasterImage,项目名称:Orchard,代码行数:8,代码来源:DescribeContext.cs

示例7: Impulse

 public ImpulseDescriptor Impulse(string name, LocalizedString caption=null, LocalizedString description=null) {
     if (!Impulses.ContainsKey(name)) {
         Impulses[name] = new ImpulseDescriptor(name);
     }
     var impulse = Impulses[name];
     if (caption != null) impulse.Caption = caption;
     if (description != null) impulse.Description = description;
     return impulse;
 }
开发者ID:akhurst,项目名称:ricealumni,代码行数:9,代码来源:ImpulseDescribeContext.cs

示例8: DescribeGraph

        public virtual void DescribeGraph(string name, LocalizedString displayName, IEnumerable<string> contentTypes, Func<IGraphDescriptor, IGraphServices> graphServicesFactory)
        {
            if (String.IsNullOrEmpty(name) || displayName == null || String.IsNullOrEmpty(displayName.Text))
            {
                throw new ArgumentException("Associativy graphs should have their Name and DisplayName set properly.");
            }

            _descriptors.Add(new GraphDescriptor(name, displayName, contentTypes, graphServicesFactory));
        }
开发者ID:Lombiq,项目名称:Associativy-Core,代码行数:9,代码来源:DescribeContext.cs

示例9: DateTime

        public IHtmlString DateTime(DateTime DateTimeUtc, LocalizedString CustomFormat) {
            //using a LocalizedString forces the caller to use a localizable format

            if (CustomFormat == null || String.IsNullOrWhiteSpace(CustomFormat.Text)) {
                return new MvcHtmlString(_dateServices.ConvertToLocalString(DateTimeUtc, _dateTimeLocalization.LongDateTimeFormat, null));
            }

            return new MvcHtmlString(_dateServices.ConvertToLocalString(DateTimeUtc, CustomFormat.Text, null));
        }
开发者ID:jdages,项目名称:AndrewsHouse,代码行数:9,代码来源:DateTimeShapes.cs

示例10: DateTime

        public IHtmlString DateTime(DateTime DateTimeUtc, LocalizedString CustomFormat) {
            //using a LocalizedString forces the caller to use a localizable format

            if (CustomFormat == null || String.IsNullOrWhiteSpace(CustomFormat.Text)) {
                return DateTime(DateTimeUtc, T("MMM d yyyy h:mm tt"));
            }

            return new MvcHtmlString(ConvertToDisplayTime(DateTimeUtc).ToString(CustomFormat.Text));
        }
开发者ID:kayone,项目名称:Orchard,代码行数:9,代码来源:DateTimeShapes.cs

示例11: DateTime

        public IHtmlString DateTime(DateTime DateTimeUtc, LocalizedString CustomFormat) {
            //using a LocalizedString forces the caller to use a localizable format

            if (CustomFormat == null || String.IsNullOrWhiteSpace(CustomFormat.Text)) {
                return DateTime(DateTimeUtc, _dateTimeLocalization.LongDateTimeFormat);
            }

            return new MvcHtmlString(ConvertToDisplayTime(DateTimeUtc).ToString(CustomFormat.Text, _cultureInfo.Value));
        }
开发者ID:jecofang01,项目名称:OrchardNoCMS,代码行数:9,代码来源:DateTimeShapes.cs

示例12: ElementDescriptor

 public ElementDescriptor(Type elementType, string typeName, LocalizedString displayText, LocalizedString description, string category) {
     ElementType = elementType;
     TypeName = typeName;
     DisplayText = displayText;
     Description = description;
     Category = category;
     GetDrivers = Enumerable.Empty<IElementDriver>;
     CreatingDisplay = context => { };
     Displaying = context => {};
     Editor = context => { };
     UpdateEditor = context => { };
     StateBag = new Dictionary<string, object>();
 }
开发者ID:mikmakcar,项目名称:orchard_fork_learning,代码行数:13,代码来源:ElementDescriptor.cs

示例13: Error

        public static void Error(this Controller controller,
            Exception exception,
            LocalizedString localizedString,
            ILogger logger,
            INotifier notifier) {

            logger.Error(exception, localizedString.ToString());
            notifier.Error(localizedString);

            for (Exception innerException = exception; innerException != null ; innerException = innerException.InnerException) {
                notifier.Error(new LocalizedString(innerException.Message));
            }
        }
开发者ID:rupertwhitlock,项目名称:IncreasinglyAbsorbing,代码行数:13,代码来源:ControllerExtensions.cs

示例14: Add

        public NavigationBuilder Add(LocalizedString caption, string position, Action<NavigationItemBuilder> itemBuilder, IEnumerable<string> classes = null) {
            var childBuilder = new NavigationItemBuilder();
            
            childBuilder.Caption(caption);
            childBuilder.Position(position);
            itemBuilder(childBuilder);
            Contained.AddRange(childBuilder.Build());

            if (classes != null) {
                foreach (var className in classes) 
                    childBuilder.AddClass(className);
            }

            return this;
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:15,代码来源:NavigationBuilder.cs

示例15: SendMessage

 public void SendMessage(FeedbackLevel level, LocalizedString message)
 {
     switch (level)
     {
         case FeedbackLevel.Info:
             Logger.Information(message.ToString());
             return;
         case FeedbackLevel.Warn:
             Logger.Information(message.ToString());
             return;
         case FeedbackLevel.Error:
             Logger.Information(message.ToString());
             return;
     }
 }
开发者ID:SmartFire,项目名称:CJP.ContentSync,代码行数:15,代码来源:DefaultRealtimeFeedbackService.cs


注:本文中的Orchard.Localization.LocalizedString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。