コード例 #1
0
ファイル: HtmlLocalizerTest.cs プロジェクト: Nishadks1/Mvc-1
        public void HtmlLocalizer_WithCulture_ReturnsLocalizedHtmlString()
        {
            // Arrange
            var stringLocalizer = new TestStringLocalizer();

            var htmlLocalizer = new HtmlLocalizer(stringLocalizer);

            // Act
            var actualLocalizedHtmlString = htmlLocalizer.WithCulture(new CultureInfo("fr"))["John"];

            // Assert
            Assert.Equal("Bonjour John", actualLocalizedHtmlString.Value);
        }
コード例 #2
0
        public void HtmlLocalizer_WithCulture_ReturnsLocalizedHtmlString()
        {
            // Arrange
            var stringLocalizer = new TestStringLocalizer();

            var htmlLocalizer = new HtmlLocalizer(stringLocalizer);

            // Act
#pragma warning disable CS0618 // Type or member is obsolete
            var actualLocalizedHtmlString = htmlLocalizer.WithCulture(new CultureInfo("fr"))["John"];
#pragma warning restore CS0618 // Type or member is obsolete

            // Assert
            Assert.Equal("Bonjour John", actualLocalizedHtmlString.Value);
        }
コード例 #3
0
ファイル: HtmlLocalizerTest.cs プロジェクト: ymd1223/Mvc
        public void HtmlLocalizer_WithCulture_ReturnsLocalizedHtmlString()
        {
            // Arrange
            var stringLocalizer = new TestStringLocalizer();

            var htmlLocalizer = new HtmlLocalizer(stringLocalizer);

            // Act
            var actualLocalizedHtmlString = htmlLocalizer.WithCulture(new CultureInfo("fr"))["John"];

            // Assert
            Assert.Equal("Bonjour John", actualLocalizedHtmlString.Value);
        }
コード例 #4
0
 /// <summary>
 /// Gets localized string for given key name and current language with formatting strings.
 /// </summary>
 protected string L(string name, CultureInfo culture, params object[] args) =>
 HtmlLocalizer.WithCulture(culture).GetString(name, args);
コード例 #5
0
 /// <summary>
 /// Gets localized string for given key name and specified culture information.
 /// </summary>
 protected string L(string name, CultureInfo culture) => HtmlLocalizer.WithCulture(culture).GetString(name);