System.Globalization.I18NComplete.OnGetting__ C# (CSharp) Method

OnGetting__() static private method

Throws the Getting__ global event

@Alias GetHtml and FormatHtml

Translates the given html applying 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

static private OnGetting__ ( System.Web.Mvc.MvcHtmlString defaultResult, CultureInfo culture, string html, object arguments ) : System.Web.Mvc.MvcHtmlString
defaultResult System.Web.Mvc.MvcHtmlString The I18NComplete default result. Returning null will fallback on this result, otherwise return a custom value to oveerride this.
culture CultureInfo The culture this translation is being translated
html string The html to be translated
arguments object Custom arguments list to be passed to string.Format
return System.Web.Mvc.MvcHtmlString
        internal static MvcHtmlString OnGetting__(MvcHtmlString defaultResult, CultureInfo culture, string html, object[] arguments)
        {
            if (Getting__ != null)
                return Getting__(defaultResult, culture, html, arguments);
            return null;
        }

Usage Example

コード例 #1
0
        /// <summary>
        ///     <para>@Alias <c>GetHtml</c> and <c>FormatHtml</c></para>
        ///     <para>Translates the given html applying string.Format(html, arguments.Select(a =&gt; HttpUtility.HtmlEncode(a))) to the current culture language. </para>
        ///     <para>The html will be kept as it is, while arguments will be automatically HTML Encoded</para>
        /// </summary>
        /// <param name="culture">The culture being extended</param>
        /// <param name="html">The html to be translated</param>
        /// <param name="arguments">Custom arguments list to be passed to string.Format</param>
        /// <returns>The translated formatted html as MvcHtmlString</returns>
        /// <created author="laurentiu.macovei" date="Fri, 06 Jan 2012 23:49:22 GMT"/>
        public static MvcHtmlString __(this CultureInfo culture, string html, params object[] arguments)
        {
            var result = new MvcHtmlString(string.Format(I18NComplete.GetText(html, lcid: culture.LCID),
                                                         arguments.Select(a => HttpUtility.HtmlEncode(a)).ToArray()));

            return
                (#if DEBUG
                 I18NComplete.OnGetting__(result, culture, html, arguments) ??
#endif
                 result);
        }