當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。