Exemplo n.º 1
0
        /// <inheritdoc />
        public virtual IHtmlLocalizer WithCulture(CultureInfo culture)
        {
            if (culture == null)
            {
                throw new ArgumentNullException(nameof(culture));
            }

            return(_localizer.WithCulture(culture));
        }
Exemplo n.º 2
0
        public virtual IHtmlLocalizer WithCulture(CultureInfo culture)
        {
            if (culture == null)
            {
                throw new ArgumentNullException(nameof(culture));
            }

#pragma warning disable CS0618 // Type or member is obsolete
            return(_localizer.WithCulture(culture));

#pragma warning restore CS0618 // Type or member is obsolete
        }
Exemplo n.º 3
0
        public static LocalizedHtmlString GetStringByCulture(this IHtmlLocalizer target, Expression <Func <object> > model, CultureInfo language, params object[] formatArguments)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            if (language == null)
            {
                throw new ArgumentNullException(nameof(language));
            }

            return(target.WithCulture(language)[ExpressionHelper.GetFullMemberName(model), formatArguments]);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Localize a string according to specified culture
        /// </summary>
        /// <param name="culture"></param>
        /// <param name="key"></param>
        /// <param name="args"></param>
        /// <returns>localized string</returns>
        public string GetLocalizedString(string culture, string key, params object[] args)
        {
            var sw = new StringWriter();

            if (args == null)
            {
                _localizer.WithCulture(CultureInfo.GetCultureInfo(culture))[key].WriteTo(sw, HtmlEncoder.Default);
            }
            else
            {
                _localizer.WithCulture(CultureInfo.GetCultureInfo(culture))[key, args].WriteTo(sw, HtmlEncoder.Default);
            }

            return(sw.ToString());
        }
 /// <inheritdoc />
 public IHtmlLocalizer WithCulture(CultureInfo culture)
 {
     return(_htmlLocalizer.WithCulture(culture));
 }
Exemplo n.º 6
0
 /// <inheritdoc />
 public IStringLocalizer WithCulture(CultureInfo culture) => _localizer.WithCulture(culture);
 /// <inheritdoc />
 public IHtmlLocalizer WithCulture(CultureInfo culture) => _localizer.WithCulture(culture);
Exemplo n.º 8
0
 /// <inheritdoc />
 public virtual IHtmlLocalizer WithCulture([NotNull] CultureInfo culture) => _localizer.WithCulture(culture);
Exemplo n.º 9
0
 public LocalizedHtmlString Text(string culture, string key, params object[] args)
 {
     return(args == null
                         ? _localizer.WithCulture(CultureInfo.GetCultureInfo(culture))[key]
                         : _localizer.WithCulture(CultureInfo.GetCultureInfo(culture))[key, args]);
 }
Exemplo n.º 10
0
 public ValuesController(IHtmlLocalizer <ValuesController> localizer)
 {
     //Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
     _localizer = localizer.WithCulture(Thread.CurrentThread.CurrentUICulture);
 }