System.Globalization.I18N.__q C# (CSharp) Method

__q() public static method

Quotes the text as the xgettext cannot correctly extract values from attributes

Translates the given html applying '"'+HttpUtility.HtmlAttributeEncode(string.Format(html, arguments.Select(a => HttpUtility.HtmlEncode(a))))+'"' to the current culture language.

The html will be kept as it is, while arguments will be automatically HTML Encoded

Usage: <input type="submit" value=@__q("Save") /> -- Note the missing quotes!

public static __q ( this culture, string html ) : System.Web.Mvc.MvcHtmlString
culture this The culture being extended
html string The html text to be translated
return System.Web.Mvc.MvcHtmlString
        public static MvcHtmlString __q(this CultureInfo culture, string html, params object[] arguments)
        {
            var result = new MvcHtmlString('"' + HttpUtility.HtmlAttributeEncode(string.Format(I18NComplete.GetText(html, lcid: culture.LCID), arguments.Select(a => HttpUtility.HtmlEncode(a)).ToArray())) + '"');
            return
            #if DEBUG
             I18NComplete.OnGetting__q(result, culture, html, arguments) ??
            #endif
             result;
        }