C# 클래스 System.Globalization.I18NComplete

The I18NComplete class
파일 보기 프로젝트 열기: adaptabi/i18N-Complete 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
BasePath string
DefaultWorkingLanguage string
DefaultWorkingLanguageLCID int
HideAllLocalizedText bool
Localizations Localization>.Dictionary

공개 메소드들

메소드 설명
GetBestLanguage ( HttpRequest request, string fallback = null ) : string

Spins through the language preferences in the supplied HttpRequest, returning the first complete or partial match on a loaded language.

GetMessage ( string msgID, string languageCode = null, int lcid = null ) : Message

Gets a translated message version of the supplied text message.

LCID ( string cultureName ) : int

비공개 메소드들

메소드 설명
GetText ( string msgID, string languageCode = null, int lcid = null, bool plural = false ) : string

Gets a translated version of the supplied text message.

I18NComplete ( ) : System.Collections.Generic

Static constructor of I18NComplete

OnGetting_ ( string defaultResult, CultureInfo culture, string text, object arguments ) : string

Throws the Getting_ global event

@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

OnGetting__ ( System.Web.Mvc.MvcHtmlString defaultResult, CultureInfo culture, string html, object arguments ) : System.Web.Mvc.MvcHtmlString

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

OnGetting___ ( System.Web.Mvc.MvcHtmlString defaultResult, CultureInfo culture, string html, string>.Func escapeArgumentFunc, object htmlArguments ) : System.Web.Mvc.MvcHtmlString

Throws the Getting___ global event

@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

OnGetting___ ( System.Web.Mvc.MvcHtmlString defaultResult, CultureInfo culture, string html, object htmlArguments ) : System.Web.Mvc.MvcHtmlString

Throws the Getting___ global event

@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

OnGetting___q ( System.Web.Mvc.MvcHtmlString defaultResult, CultureInfo culture, string html ) : System.Web.Mvc.MvcHtmlString

Throws the Getting___q global event

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!

OnGetting___s ( System.Web.Mvc.MvcHtmlString defaultResult, CultureInfo culture, string singularHTML, string pluralHTML, int count, string>.Func escapeArgumentFunc, object htmlArguments ) : System.Web.Mvc.MvcHtmlString

Throws the Getting___s global event

@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

OnGetting___s ( System.Web.Mvc.MvcHtmlString defaultResult, CultureInfo culture, string singularHTML, string pluralHTML, int count, object htmlArguments ) : System.Web.Mvc.MvcHtmlString

Throws the Getting___s global event

@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

OnGetting__q ( System.Web.Mvc.MvcHtmlString defaultResult, CultureInfo culture, string html ) : System.Web.Mvc.MvcHtmlString

Throws the Getting__q global event

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!

OnGetting__s ( System.Web.Mvc.MvcHtmlString defaultResult, CultureInfo culture, string singularHTML, string pluralHTML, int count, object arguments ) : System.Web.Mvc.MvcHtmlString

Throws the Getting__s global event

@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

OnGetting_s ( string defaultResult, CultureInfo culture, string singular, string plural, int count ) : string

Throws the Getting_s global event

@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

메소드 상세

GetBestLanguage() 공개 정적인 메소드

Spins through the language preferences in the supplied HttpRequest, returning the first complete or partial match on a loaded language.
public static GetBestLanguage ( HttpRequest request, string fallback = null ) : string
request System.Web.HttpRequest
fallback string
리턴 string

GetMessage() 공개 정적인 메소드

Gets a translated message version of the supplied text message.
public static GetMessage ( string msgID, string languageCode = null, int lcid = null ) : Message
msgID string Text to be translated
languageCode string Language to translate into
lcid int Specify the Culture LCID for faster access if you know it
리턴 Message

LCID() 공개 정적인 메소드

public static LCID ( string cultureName ) : int
cultureName string
리턴 int

프로퍼티 상세

BasePath 공개적으로 정적으로 프로퍼티

This is the base path under which localizations will be stored.
public static string BasePath
리턴 string

DefaultWorkingLanguage 공개적으로 정적으로 프로퍼티

The language that MsgIDs are given in (generally the language the project is being developed in).
public static string DefaultWorkingLanguage
리턴 string

DefaultWorkingLanguageLCID 공개적으로 정적으로 프로퍼티

The default culture LCID
public static int DefaultWorkingLanguageLCID
리턴 int

HideAllLocalizedText 공개적으로 정적으로 프로퍼티

FOR TESTING ONLY! If true, all calls to GetText will return an empty string. this is useful when searching for any strings that might not be flagged for localization.
public static bool HideAllLocalizedText
리턴 bool

Localizations 공개적으로 정적으로 프로퍼티

The cached localization
public static Dictionary Localizations
리턴 Localization>.Dictionary