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


C# Localizer.Add方法代码示例

本文整理汇总了C#中Localizer.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Localizer.Add方法的具体用法?C# Localizer.Add怎么用?C# Localizer.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Localizer的用法示例。


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

示例1: 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

示例2: TemplateOverride

		[Test] public void TemplateOverride ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("Plural", "{1}s");
			loc.Add("Plural'Story", "Stories");
			Assert.AreEqual("Scopes", loc.Resolve("Plural'Scope"));
			Assert.AreEqual("Stories", loc.Resolve("Plural'Story"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:8,代码来源:LocalizerTester.cs

示例3: PluralAssocTemplate

		[Test] public void PluralAssocTemplate ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("Plural", "{1}s");
			loc.Add("Plural'AssetType", "{Plural'{1'2}'}");
			loc.Add("AssetType'Fronat", "Memo");
			Assert.AreEqual("Memos", loc.Resolve("Plural'AssetType'Fronat"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:8,代码来源:LocalizerTester.cs

示例4: PluralNestTemplate

		[Test] public void PluralNestTemplate ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("Plural", "{1}s");
			loc.Add("Plural'AssetType", "{Plural'{1'2}'x}");
			loc.Add("AssetType'Story", "Backlog Item");
			Assert.AreEqual("Backlog Items", loc.Resolve("Plural'AssetType'Story"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:8,代码来源:LocalizerTester.cs

示例5: ComplexTemplate

		[Test] public void ComplexTemplate ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("Plural", "{1}s");
			loc.Add("Plural'Story", "Stories");
			loc.Add("Report2", "Report {Plural'1}/{Plural'2}");
			loc.Add("Scope", "Project");
			Assert.AreEqual("Report Projects/Stories", loc.Resolve("Report2'Scope'Story"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:9,代码来源:LocalizerTester.cs

示例6: NoInfiniteRecursion

		[Test] public void NoInfiniteRecursion ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("bogus", "recursive {0} recursive");
			Assert.AreEqual("recursive bogus recursive", loc.Resolve("bogus"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:6,代码来源:LocalizerTester.cs

示例7: PluralTemplate

		[Test] public void PluralTemplate ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("Plural", "{1}s");
			Assert.AreEqual("AssetTypes", loc.Resolve("Plural'AssetType'Story"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:6,代码来源:LocalizerTester.cs

示例8: EmptyBraces

		[Test] public void EmptyBraces()
		{
			Localizer loc = new Localizer(null);
			loc.Add("A", "{}");
			Assert.AreEqual("", loc.Resolve("A"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:6,代码来源:LocalizerTester.cs

示例9: ValueWithSpecialCharacter

		[Test] public void ValueWithSpecialCharacter()
		{
			const string tag = "solution";
			const string translation = "løsningsforslag";
			var loc = new Localizer(null);
			loc.Add(tag, translation);
			Assert.AreEqual(translation, loc.Resolve(tag));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:8,代码来源:LocalizerTester.cs

示例10: BracesNest

		[Test] public void BracesNest ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("match", "open {{{and}}} close");
			loc.Add("and", "xyz");
			Assert.AreEqual("open {xyz} close", loc.Resolve("match"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:7,代码来源:LocalizerTester.cs

示例11: ConditionalSpaceYes

		[Test] public void ConditionalSpaceYes ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("A", "x {1}");
			loc.Add("B", "y");
			Assert.AreEqual("x y", loc.Resolve("A'B"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:7,代码来源:LocalizerTester.cs

示例12: MatchingDoubleBrace

		[Test] public void MatchingDoubleBrace ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("match", "open {{and}} close");
			loc.Add("and", "xyz");
			Assert.AreEqual("open {and} close", loc.Resolve("match"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:7,代码来源:LocalizerTester.cs

示例13: DoubleBrace

		[Test] public void DoubleBrace ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("open", "open {{ brace");
			loc.Add("close", "close }} brace");
			Assert.AreEqual("open { brace", loc.Resolve("open"));
			Assert.AreEqual("close } brace", loc.Resolve("close"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:8,代码来源:LocalizerTester.cs

示例14: SimpleTranslate

		[Test] public void SimpleTranslate ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("tag1", "This is the tag 1 string");
			Assert.AreEqual("This is the tag 1 string", loc.Resolve("tag1"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:6,代码来源:LocalizerTester.cs

示例15: AlwaysExpand

		[Test] public void AlwaysExpand ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("Add'Story", "Add {Story}");
			Assert.AreEqual("Add Story", loc.Resolve("Add'Story"));
		}
开发者ID:versionone,项目名称:VersionOne.Localization,代码行数:6,代码来源:LocalizerTester.cs


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