本文整理汇总了C#中Localizer类的典型用法代码示例。如果您正苦于以下问题:C# Localizer类的具体用法?C# Localizer怎么用?C# Localizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Localizer类属于命名空间,在下文中一共展示了Localizer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LocalizedRangeAttribute
public LocalizedRangeAttribute(RangeAttribute attribute, Localizer t)
: base(attribute.OperandType, new FormatterConverter().ToString(attribute.Minimum), new FormatterConverter().ToString(attribute.Maximum)) {
if ( !String.IsNullOrEmpty(attribute.ErrorMessage) )
ErrorMessage = attribute.ErrorMessage;
T = t;
}
示例2: CascadedTemplate
[Test] public void CascadedTemplate ()
{
Localizer loc = new Localizer(null);
loc.Add("Plural", "{1}s");
loc.Add("Report2", "Report {Plural'1}/{Plural'2}");
Assert.AreEqual("Report Scopes/Storys", loc.Resolve("Report2'Scope'Story"));
}
示例3: TermsFilterForms
public TermsFilterForms(
IShapeFactory shapeFactory,
ITaxonomyService taxonomyService) {
_taxonomyService = taxonomyService;
Shape = shapeFactory;
T = NullLocalizer.Instance;
}
示例4: CreateFilteredRequestTable
public static MvcHtmlString CreateFilteredRequestTable(this HtmlHelper helper, IQueryable<FilteredRequestRecord> filteredRequestRecords, Localizer T)
{
StringBuilder sb = new StringBuilder();
if (filteredRequestRecords == null || !filteredRequestRecords.Any())
{
sb.AppendLine(T("No requests are filtered yet.").Text);
}
else
{
sb.AppendLine("<table><tr>");
sb.AppendFormat("<th>{0}</th>", T("Request time"));
sb.AppendFormat("<th>{0}</th>", T("Url"));
sb.AppendFormat("<th>{0}</th>", T("User Host Address"));
sb.AppendFormat("<th>{0}</th>", T("User Agent"));
sb.AppendLine("</tr>");
foreach (FilteredRequestRecord filteredRequest in filteredRequestRecords.OrderByDescending(r => r.RequestTime))
{
sb.AppendLine("<tr>");
sb.AppendFormat("<td>{0}</td>", filteredRequest.RequestTime);
sb.AppendFormat("<td>{0}</td>", filteredRequest.Url);
sb.AppendFormat("<td>{0}</td>", filteredRequest.UserHostAddress);
sb.AppendFormat("<td>{0}</td>", filteredRequest.UserAgent);
sb.AppendLine("</tr>");
}
sb.AppendLine("</table>");
}
return new MvcHtmlString(sb.ToString());
}
示例5: ContentPartRecordsForm
public ContentPartRecordsForm(
ShellBlueprint shellBlueprint,
IShapeFactory shapeFactory) {
_shellBlueprint = shellBlueprint;
Shape = shapeFactory;
T = NullLocalizer.Instance;
}
示例6: DisplayFilter
public static LocalizedString DisplayFilter(string fieldName, dynamic formState, Localizer T)
{
var op = (NumericOperator)Enum.Parse(typeof(NumericOperator), Convert.ToString(formState.Operator));
string value = Convert.ToString(formState.Value);
string min = Convert.ToString(formState.Min);
string max = Convert.ToString(formState.Max);
switch (op) {
case NumericOperator.LessThan:
return T("{0} is less than {1}", fieldName, value);
case NumericOperator.LessThanEquals:
return T("{0} is less or equal than {1}", fieldName, value);
case NumericOperator.Equals:
return T("{0} equals {1}", fieldName, value);
case NumericOperator.NotEquals:
return T("{0} is not equal to {1}", fieldName, value);
case NumericOperator.GreaterThan:
return T("{0} is greater than {1}", fieldName, value);
case NumericOperator.GreaterThanEquals:
return T("{0} is greater or equal than {1}", fieldName, value);
case NumericOperator.Between:
return T("{0} is between {1} and {2}", fieldName, min, max);
case NumericOperator.NotBetween:
return T("{0} is not between {1} and {2}", fieldName, min, max);
}
// should never be hit, but fail safe
return new LocalizedString(fieldName);
}
示例7: EventController
public EventController(IOrchardServices services,
IEventService eventService)
{
T = NullLocalizer.Instance;
_eventService = eventService;
_services = services;
}
示例8: RelationshipController
public RelationshipController(
IRelationshipService relationshipService,
IRepository<RelationshipRecord> relationshipRepository) {
_relationshipService = relationshipService;
_relationshipRepository = relationshipRepository;
T = NullLocalizer.Instance;
}
示例9: AdminController
public AdminController(IOrchardServices orchardService, IDirectoryNavService directoryNavService)
{
_orchardServices = orchardService;
_directoryNavService = directoryNavService;
T = NullLocalizer.Instance;
}
示例10: WinXinRespForms
public WinXinRespForms(IShapeFactory shapeFactory, IContentManager contentManager)
{
Shape = shapeFactory;
T = NullLocalizer.Instance;
_contentManager = contentManager;
}
示例11: DisplayFilter
public static LocalizedString DisplayFilter(string fieldName, dynamic formState, Localizer T) {
bool value = Convert.ToBoolean(formState.Value);
fieldName = fieldName.Split('.')[1];
return value
? T("{0} is true", fieldName)
: T("{0} is false", fieldName);
}
示例12: AddressDirectoryService
public AddressDirectoryService(IOrchardServices services,Lazy<IMechanicsService> mechanics)
{
_services = services;
_mechanics = mechanics;
Logger = NullLogger.Instance;
T = NullLocalizer.Instance;
}
示例13: DisplayFilter
public static LocalizedString DisplayFilter(string fieldName, dynamic formState, Localizer T) {
var op = (Orchard.Projections.FilterEditors.Forms.StringOperator) Enum.Parse(typeof (Orchard.Projections.FilterEditors.Forms.StringOperator), Convert.ToString(formState.Operator));
string value = Convert.ToString(formState.Value);
fieldName = fieldName.Split('.')[1];
switch (op) {
case Orchard.Projections.FilterEditors.Forms.StringOperator.Equals:
return T("{0} is equal to '{1}'", fieldName, value);
case Orchard.Projections.FilterEditors.Forms.StringOperator.NotEquals:
return T("{0} is not equal to '{1}'", fieldName, value);
case Orchard.Projections.FilterEditors.Forms.StringOperator.Contains:
return T("{0} contains '{1}'", fieldName, value);
case Orchard.Projections.FilterEditors.Forms.StringOperator.ContainsAny:
return T("{0} contains any of '{1}'", fieldName, new LocalizedString(String.Join("', '", value.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries))));
case Orchard.Projections.FilterEditors.Forms.StringOperator.ContainsAll:
return T("{0} contains all '{1}'", fieldName, new LocalizedString(String.Join("', '", value.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries))));
case Orchard.Projections.FilterEditors.Forms.StringOperator.Starts:
return T("{0} starts with '{1}'", fieldName, value);
case Orchard.Projections.FilterEditors.Forms.StringOperator.NotStarts:
return T("{0} does not start with '{1}'", fieldName, value);
case Orchard.Projections.FilterEditors.Forms.StringOperator.Ends:
return T("{0} ends with '{1}'", fieldName, value);
case Orchard.Projections.FilterEditors.Forms.StringOperator.NotEnds:
return T("{0} does not end with '{1}'", fieldName, value);
case Orchard.Projections.FilterEditors.Forms.StringOperator.NotContains:
return T("{0} does not contain '{1}'", fieldName, value);
default:
throw new ArgumentOutOfRangeException();
}
}
示例14: OrderController
public OrderController(IWebStoreConfigurationService webStoreConfigurationServices, IBasketServices basketServices, IWebStoreProfileServices webstoreProfileServices)
{
this.T = NullLocalizer.Instance;
this._basketServices = basketServices;
this._webstoreProfileServices = webstoreProfileServices;
this._webStoreConfigurationServices = webStoreConfigurationServices;
}
示例15: AdminUserController
public AdminUserController(
IRepository<RoleRecord> roleRepository,
IOrderService orderService,
ICampaignService campaignService,
IRepository<CurrencyRecord> currencyRepository,
IMembershipService membershipService,
ShellSettings shellSettings,
IOrchardServices services,
IUserService userService,
ISiteService siteService,
IShapeFactory shapeFactory)
{
_roleRepository = roleRepository;
_orderService = orderService;
_campaignService = campaignService;
_currencyRepository = currencyRepository;
_membershipService = membershipService;
_shellSettings = shellSettings;
Services = services;
_siteService = siteService;
_userService = userService;
T = NullLocalizer.Instance;
Shape = shapeFactory;
}