Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 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);
Ejemplo n.º 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);