本文整理汇总了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;
}
示例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));
}
示例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;
}
示例4: Add
public BindingBuilder Add(PropertyInfo property, LocalizedString display, LocalizedString description) {
_memberBindings.Add( new BindingItem{
Property = property,
DisplayName = display,
Description = description
});
return this;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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>();
}
示例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));
}
}
示例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;
}
示例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;
}
}