本文整理汇总了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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例7: PluralTemplate
[Test] public void PluralTemplate ()
{
Localizer loc = new Localizer(null);
loc.Add("Plural", "{1}s");
Assert.AreEqual("AssetTypes", loc.Resolve("Plural'AssetType'Story"));
}
示例8: EmptyBraces
[Test] public void EmptyBraces()
{
Localizer loc = new Localizer(null);
loc.Add("A", "{}");
Assert.AreEqual("", loc.Resolve("A"));
}
示例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));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}