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


C# Localizer类代码示例

本文整理汇总了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;
        }
开发者ID:anycall,项目名称:Orchard,代码行数:7,代码来源:LocalizedRangeAttribute.cs

示例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"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:7,代码来源:LocalizerTester.cs

示例3: TermsFilterForms

 public TermsFilterForms(
     IShapeFactory shapeFactory,
     ITaxonomyService taxonomyService) {
     _taxonomyService = taxonomyService;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
开发者ID:Higea,项目名称:Orchard,代码行数:7,代码来源:TermsFilterForms.cs

示例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());
        }
开发者ID:rijkshuisstijl,项目名称:Rijkshuisstijl.UrlProtector,代码行数:30,代码来源:UrlProtectorHtmlHelper.cs

示例5: ContentPartRecordsForm

 public ContentPartRecordsForm(
     ShellBlueprint shellBlueprint,
     IShapeFactory shapeFactory) {
     _shellBlueprint = shellBlueprint;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
开发者ID:RasterImage,项目名称:Orchard,代码行数:7,代码来源:ContentPartRecordsForm.cs

示例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);
        }
开发者ID:galyna,项目名称:maozedong-orchard1,代码行数:29,代码来源:NumericFilterForm.cs

示例7: EventController

 public EventController(IOrchardServices services, 
     IEventService eventService)
 {
     T = NullLocalizer.Instance;
     _eventService = eventService;
     _services = services;
 }
开发者ID:NFLPA,项目名称:NFLPA.CalendarEvents,代码行数:7,代码来源:EventController.cs

示例8: RelationshipController

 public RelationshipController(
     IRelationshipService relationshipService,
     IRepository<RelationshipRecord> relationshipRepository) {
     _relationshipService = relationshipService;
     _relationshipRepository = relationshipRepository;
     T = NullLocalizer.Instance;
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:7,代码来源:RelationshipController.cs

示例9: AdminController

        public AdminController(IOrchardServices orchardService, IDirectoryNavService directoryNavService)
        {
            _orchardServices = orchardService;
            _directoryNavService = directoryNavService;

            T = NullLocalizer.Instance;
        }
开发者ID:bolorock,项目名称:Orchard.Bolo.DirectoryNav,代码行数:7,代码来源:AdminController.cs

示例10: WinXinRespForms

        public WinXinRespForms(IShapeFactory shapeFactory, IContentManager contentManager)
        {
            Shape = shapeFactory;
            T = NullLocalizer.Instance;

            _contentManager = contentManager;
        }
开发者ID:ccccccmd,项目名称:Orchard.WeChat,代码行数:7,代码来源:WinXinRespForms.cs

示例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);
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:7,代码来源:BooleanFilterForm.cs

示例12: AddressDirectoryService

 public AddressDirectoryService(IOrchardServices services,Lazy<IMechanicsService> mechanics)
 {
     _services = services;
     _mechanics = mechanics;
     Logger = NullLogger.Instance;
     T = NullLocalizer.Instance;
 }
开发者ID:akhurst,项目名称:ricealumni,代码行数:7,代码来源:AddressDirectoryService.cs

示例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();
     }
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:29,代码来源:StringFilterForm.cs

示例14: OrderController

 public OrderController(IWebStoreConfigurationService webStoreConfigurationServices, IBasketServices basketServices, IWebStoreProfileServices webstoreProfileServices)
 {
     this.T = NullLocalizer.Instance;
     this._basketServices = basketServices;
     this._webstoreProfileServices = webstoreProfileServices;
     this._webStoreConfigurationServices = webStoreConfigurationServices;
 }
开发者ID:homastudiocorp,项目名称:SnagIt,代码行数:7,代码来源:OrderController.cs

示例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;
        }
开发者ID:omidam81,项目名称:Ver1.0,代码行数:25,代码来源:AdminUserController.cs


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