C# Class System.Web.Mvc.LocalizableWebViewPage

A transparent localizable class which represents the properties and methods that are needed in order to render a view that uses ASP.NET Razor syntax.
Inheritance: System.Web.Mvc.WebViewPage
Show file Open project: adaptabi/i18N-Complete

Public Methods

Method Description
Format ( string text ) : string

@Alias _ and GetString

Translates the given text applying string.Format(text, arguments) to the current culture language.

The text and argument values will be HTML Encoded when used in ASP.NET MVC

FormatHtml ( string html ) : System.Web.Mvc.MvcHtmlString

@Alias __ and GetHtml

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

FormatHtmlPlural ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString

@Alias GetPluralHtml and FormatHtmlPlural

Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => HttpUtility.HtmlEncode(a))) to the current culture language.

The singular/plural HTML will be kept as it is, while arguments will be automatically HTML Encoded

FormatPlural ( string singular, string plural, int count ) : string

@Alias _ (1 underscore) and GetPluralString

Translates the given singular or plural text applying string.Format(text, arguments) to the current culture language.

The singular/plural text and argument values will be HTML Encoded when used in ASP.NET MVC

FormatRaw ( string html ) : System.Web.Mvc.MvcHtmlString

@Alias ___ (3 underscores) and GetRaw

Translates the given html applying string.Format(html, htmlArguments) to the current culture language.

For each argument the escape func will be called before applying the format

FormatRaw ( string html, object>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString

@Alias ___ (3 underscores) and FormatRaw

Translates the given html applying string.Format(html, arguments) to the current culture language.

For each argument the escape func will be called before applying the format

FormatRawPlural ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString

@Alias ___s (3 underscores and s) and GetPluralRaw

Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

FormatRawPlural ( string singularHTML, string pluralHTML, int count, string>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString

@Alias ___s (3 underscores and s) and GetPluralRaw

Translates the given singular or plural text/html applying string.Format(count == 1 ? singular : plural, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

GetHtml ( string html ) : System.Web.Mvc.MvcHtmlString

@Alias __ 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

GetPluralHtml ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString

@Alias __ (2 underscores) and FormatHtmlPlural

Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => HttpUtility.HtmlEncode(a))) to the current culture language.

The singular/plural HTML will be kept as it is, while arguments will be automatically HTML Encoded

GetPluralRaw ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString

@Alias ___s (3 underscores and s) and FormatRawPlural

Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

GetPluralRaw ( string singularHTML, string pluralHTML, int count, string>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString

@Alias ___s (3 underscores and s) and FormatRawPlural

Translates the given singular or plural text/html applying string.Format(count == 1 ? singular : plural, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

GetPluralString ( string singular, string plural, int count ) : string

@Alias _ (1 underscore) and FormatPlural

Translates the given singular or plural text applying string.Format(text, arguments) to the current culture language.

The singular/plural text and argument values will be HTML Encoded when used in ASP.NET MVC

GetRaw ( string html ) : System.Web.Mvc.MvcHtmlString

@Alias ___ (3 underscores) and FormatRaw

Translates the given html applying string.Format(html, htmlArguments) to the current culture language.

Warning! Neither the html nor the htmlArguments will be encoded whatsoever

GetRaw ( string html, object>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString

@Alias ___ (3 underscores) and FormatRaw

Translates the given html applying string.Format(html, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

GetString ( string text ) : string

@Alias _ and Format

Translates the given text applying string.Format(text, arguments) to the current culture language.

The text and argument values will be HTML Encoded when used in ASP.NET MVC

_ ( string text ) : string

@Alias GetString and Format

Translates the given text applying string.Format(text, arguments) to the current culture language.

The text and argument values will be HTML Encoded when used in ASP.NET MVC

__ ( string html ) : System.Web.Mvc.MvcHtmlString

@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

___ ( string html ) : System.Web.Mvc.MvcHtmlString

@Alias GetRaw and FormatRaw

Translates the given html applying string.Format(html, htmlArguments) to the current culture language.

Warning! Neither the html nor the htmlArguments will be encoded whatsoever

___ ( string html, string>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString

@Alias GetRaw and FormatRaw

Translates the given html applying string.Format(html, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

___q ( string html ) : System.Web.Mvc.MvcHtmlString

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

Translates the given html applying '"'+HttpUtility.HtmlAttributeEncode(string.Format(html, htmlArguments))+'"' to the current culture language.

Warning! Neither the html nor the htmlArguments will be encoded whatsoever

Usage: <div title=@___q("< class='tip'>There are {0} {1} in cart.</div>", 3, "<b>Items</b>")>... -- Note the missing quotes!

___s ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString

@Alias GetPluralRaw and FormatRawPlural

Translates the given singular or plural HTML applying string.Format(html, arguments) to the current culture language.

Warning! Neither the html nor the htmlArguments will be encoded whatsoever

___s ( string singularHTML, string pluralHTML, int count, string>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString

@Alias GetPluralRaw and FormatRawPlural

Translates the given singular or plural text/html applying string.Format(count == 1 ? singular : plural, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

__q ( string html ) : System.Web.Mvc.MvcHtmlString

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!

__s ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString

@Alias GetPluralHtml and FormatHtmlPlural

Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => HttpUtility.HtmlEncode(a))) to the current culture language.

The singular/plural HTML will be kept as it is, while arguments will be automatically HTML Encoded

_s ( string singular, string plural, int count ) : string

@Alias GetPluralString and FormatPlural

Translates the given singular or plural text applying string.Format(text, arguments) to the current culture language.

The singular/plural text and argument values will be HTML Encoded when used in ASP.NET MVC

Protected Methods

Method Description
WriteAttributeTo ( string pageVirtualPath, TextWriter writer, string name, PositionTagged prefix, PositionTagged suffix ) : void

Fixed MVC 4 bug <div [email protected]("\"A&B\") to render correctly <div title="A&B"

Private Methods

Method Description
WritePositionTaggedLiteral ( TextWriter writer, string pageVirtualPath, PositionTagged value ) : void

Fixed MVC 4 bug <div [email protected]("\"A&B\") to render correctly <div title="A&B"

WritePositionTaggedLiteral ( TextWriter writer, string pageVirtualPath, string value, int position ) : void

Fixed MVC 4 bug <div [email protected]("\"A&B\") to render correctly <div title="A&B"

Method Details

Format() public static method

@Alias _ and GetString

Translates the given text applying string.Format(text, arguments) to the current culture language.

The text and argument values will be HTML Encoded when used in ASP.NET MVC

public static Format ( string text ) : string
text string The text to be translated
return string

FormatHtml() public static method

@Alias __ and GetHtml

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

public static FormatHtml ( string html ) : System.Web.Mvc.MvcHtmlString
html string The html to be translated
return System.Web.Mvc.MvcHtmlString

FormatHtmlPlural() public static method

@Alias GetPluralHtml and FormatHtmlPlural

Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => HttpUtility.HtmlEncode(a))) to the current culture language.

The singular/plural HTML will be kept as it is, while arguments will be automatically HTML Encoded

public static FormatHtmlPlural ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString
singularHTML string The HTML to be translated when count is 1
pluralHTML string The HTML to be translated when count is NOT 1
count int If count is 1 the singular HTML will be used, otherwise the plural text
return System.Web.Mvc.MvcHtmlString

FormatPlural() public static method

@Alias _ (1 underscore) and GetPluralString

Translates the given singular or plural text applying string.Format(text, arguments) to the current culture language.

The singular/plural text and argument values will be HTML Encoded when used in ASP.NET MVC

public static FormatPlural ( string singular, string plural, int count ) : string
singular string The text to be translated when count is 1
plural string The text to be translated when count is NOT 1
count int If count is 1 the singular text will be used, otherwise the plural text
return string

FormatRaw() public static method

@Alias ___ (3 underscores) and GetRaw

Translates the given html applying string.Format(html, htmlArguments) to the current culture language.

For each argument the escape func will be called before applying the format

public static FormatRaw ( string html ) : System.Web.Mvc.MvcHtmlString
html string The html to be translated
return System.Web.Mvc.MvcHtmlString

FormatRaw() public static method

@Alias ___ (3 underscores) and FormatRaw

Translates the given html applying string.Format(html, arguments) to the current culture language.

For each argument the escape func will be called before applying the format

public static FormatRaw ( string html, object>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString
html string The html to be translated
escapeArgumentFunc object>.Func The func to be applied for each argument .i.e. a => HttpUtility.HtmlAttributeEncode(a)
return System.Web.Mvc.MvcHtmlString

FormatRawPlural() public static method

@Alias ___s (3 underscores and s) and GetPluralRaw

Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

public static FormatRawPlural ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString
singularHTML string The HTML to be translated when count is 1
pluralHTML string The HTML to be translated when count is NOT 1
count int If count is 1 the singular HTML will be used, otherwise the plural HTML
return System.Web.Mvc.MvcHtmlString

FormatRawPlural() public static method

@Alias ___s (3 underscores and s) and GetPluralRaw

Translates the given singular or plural text/html applying string.Format(count == 1 ? singular : plural, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

public static FormatRawPlural ( string singularHTML, string pluralHTML, int count, string>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString
singularHTML string The text/HTML to be translated when count is 1
pluralHTML string The text/HTML to be translated when count is NOT 1
count int If count is 1 the singular text/HTML will be used, otherwise the plural text
escapeArgumentFunc string>.Func The func to be applied for each argument .i.e. a => HttpUtility.HtmlAttributeEncode(a)
return System.Web.Mvc.MvcHtmlString

GetHtml() public static method

@Alias __ 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

public static GetHtml ( string html ) : System.Web.Mvc.MvcHtmlString
html string The html to be translated
return System.Web.Mvc.MvcHtmlString

GetPluralHtml() public static method

@Alias __ (2 underscores) and FormatHtmlPlural

Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => HttpUtility.HtmlEncode(a))) to the current culture language.

The singular/plural HTML will be kept as it is, while arguments will be automatically HTML Encoded

public static GetPluralHtml ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString
singularHTML string The HTML to be translated when count is 1
pluralHTML string The HTML to be translated when count is NOT 1
count int If count is 1 the singular HTML will be used, otherwise the plural text
return System.Web.Mvc.MvcHtmlString

GetPluralRaw() public static method

@Alias ___s (3 underscores and s) and FormatRawPlural

Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

public static GetPluralRaw ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString
singularHTML string The HTML to be translated when count is 1
pluralHTML string The HTML to be translated when count is NOT 1
count int If count is 1 the singular HTML will be used, otherwise the plural HTML
return System.Web.Mvc.MvcHtmlString

GetPluralRaw() public static method

@Alias ___s (3 underscores and s) and FormatRawPlural

Translates the given singular or plural text/html applying string.Format(count == 1 ? singular : plural, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

public static GetPluralRaw ( string singularHTML, string pluralHTML, int count, string>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString
singularHTML string The text/HTML to be translated when count is 1
pluralHTML string The text/HTML to be translated when count is NOT 1
count int If count is 1 the singular text/HTML will be used, otherwise the plural text
escapeArgumentFunc string>.Func The func to be applied for each argument .i.e. a => HttpUtility.HtmlAttributeEncode(a)
return System.Web.Mvc.MvcHtmlString

GetPluralString() public static method

@Alias _ (1 underscore) and FormatPlural

Translates the given singular or plural text applying string.Format(text, arguments) to the current culture language.

The singular/plural text and argument values will be HTML Encoded when used in ASP.NET MVC

public static GetPluralString ( string singular, string plural, int count ) : string
singular string The text to be translated when count is 1
plural string The text to be translated when count is NOT 1
count int If count is 1 the singular text will be used, otherwise the plural text
return string

GetRaw() public static method

@Alias ___ (3 underscores) and FormatRaw

Translates the given html applying string.Format(html, htmlArguments) to the current culture language.

Warning! Neither the html nor the htmlArguments will be encoded whatsoever

public static GetRaw ( string html ) : System.Web.Mvc.MvcHtmlString
html string The html to be translated
return System.Web.Mvc.MvcHtmlString

GetRaw() public static method

@Alias ___ (3 underscores) and FormatRaw

Translates the given html applying string.Format(html, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

public static GetRaw ( string html, object>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString
html string The html to be translated
escapeArgumentFunc object>.Func The func to be applied for each argument .i.e. a => HttpUtility.HtmlAttributeEncode(a)
return System.Web.Mvc.MvcHtmlString

GetString() public static method

@Alias _ and Format

Translates the given text applying string.Format(text, arguments) to the current culture language.

The text and argument values will be HTML Encoded when used in ASP.NET MVC

public static GetString ( string text ) : string
text string The text to be translated
return string

WriteAttributeTo() protected method

Fixed MVC 4 bug <div [email protected]("\"A&B\") to render correctly <div title="A&B"
protected WriteAttributeTo ( string pageVirtualPath, TextWriter writer, string name, PositionTagged prefix, PositionTagged suffix ) : void
pageVirtualPath string
writer TextWriter
name string
prefix PositionTagged
suffix PositionTagged
return void

_() public static method

@Alias GetString and Format

Translates the given text applying string.Format(text, arguments) to the current culture language.

The text and argument values will be HTML Encoded when used in ASP.NET MVC

public static _ ( string text ) : string
text string The text to be translated
return string

__() public static method

@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

public static __ ( string html ) : System.Web.Mvc.MvcHtmlString
html string The html to be translated
return System.Web.Mvc.MvcHtmlString

___() public static method

@Alias GetRaw and FormatRaw

Translates the given html applying string.Format(html, htmlArguments) to the current culture language.

Warning! Neither the html nor the htmlArguments will be encoded whatsoever

public static ___ ( string html ) : System.Web.Mvc.MvcHtmlString
html string The html to be translated
return System.Web.Mvc.MvcHtmlString

___() public static method

@Alias GetRaw and FormatRaw

Translates the given html applying string.Format(html, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

public static ___ ( string html, string>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString
html string The text to be translated
escapeArgumentFunc string>.Func The func to be applied for each argument .i.e. a => HttpUtility.HtmlAttributeEncode(a)
return System.Web.Mvc.MvcHtmlString

___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, htmlArguments))+'"' to the current culture language.

Warning! Neither the html nor the htmlArguments will be encoded whatsoever

Usage: <div title=@___q("< class='tip'>There are {0} {1} in cart.</div>", 3, "<b>Items</b>")>... -- Note the missing quotes!

public static ___q ( string html ) : System.Web.Mvc.MvcHtmlString
html string The html to be translated
return System.Web.Mvc.MvcHtmlString

___s() public static method

@Alias GetPluralRaw and FormatRawPlural

Translates the given singular or plural HTML applying string.Format(html, arguments) to the current culture language.

Warning! Neither the html nor the htmlArguments will be encoded whatsoever

public static ___s ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString
singularHTML string The HTML to be translated when count is 1
pluralHTML string The HTML to be translated when count is NOT 1
count int If count is 1 the singular HTML will be used, otherwise the plural HTML
return System.Web.Mvc.MvcHtmlString

___s() public static method

@Alias GetPluralRaw and FormatRawPlural

Translates the given singular or plural text/html applying string.Format(count == 1 ? singular : plural, arguments.Select(a => escapeArgumentFunc(a))) to the current culture language.

For each argument the escape func will be called before applying the format

public static ___s ( string singularHTML, string pluralHTML, int count, string>.Func escapeArgumentFunc ) : System.Web.Mvc.MvcHtmlString
singularHTML string The text/HTML to be translated when count is 1
pluralHTML string The text/HTML to be translated when count is NOT 1
count int If count is 1 the singular text/HTML will be used, otherwise the plural text
escapeArgumentFunc string>.Func The func to be applied for each argument .i.e. a => HttpUtility.HtmlAttributeEncode(a)
return System.Web.Mvc.MvcHtmlString

__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 ( string html ) : System.Web.Mvc.MvcHtmlString
html string The text to be translated
return System.Web.Mvc.MvcHtmlString

__s() public static method

@Alias GetPluralHtml and FormatHtmlPlural

Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => HttpUtility.HtmlEncode(a))) to the current culture language.

The singular/plural HTML will be kept as it is, while arguments will be automatically HTML Encoded

public static __s ( string singularHTML, string pluralHTML, int count ) : System.Web.Mvc.MvcHtmlString
singularHTML string The HTML to be translated when count is 1
pluralHTML string The HTML to be translated when count is NOT 1
count int If count is 1 the singular HTML will be used, otherwise the plural text
return System.Web.Mvc.MvcHtmlString

_s() public static method

@Alias GetPluralString and FormatPlural

Translates the given singular or plural text applying string.Format(text, arguments) to the current culture language.

The singular/plural text and argument values will be HTML Encoded when used in ASP.NET MVC

public static _s ( string singular, string plural, int count ) : string
singular string The text to be translated when count is 1
plural string The text to be translated when count is NOT 1
count int If count is 1 the singular text will be used, otherwise the plural text
return string