C# Класс Framework.Mvc.Helpers.ResourceHelper

Provides methods for resources retrieving.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
Areas String
MainAreas String[]
ScopeSeparator String
SlashSeparator char
ViewScopeKey String

Открытые методы

Метод Описание
Combine ( ) : String

Generates resource key from chains.

Combine ( IEnumerable chains ) : String

Generates resource key from chains.

GetCommonMessagesScope ( ) : String

Gets the common error messages localization scope.

GetControllerScope ( Controller controller ) : String

Builds controller localization scope by it's namespace and type ([AreaName.]Controllers.{ControllerName}).

GetControllerScope ( String areaName, String controllerName ) : String

Gets the controller scope.

GetModelScope ( Type modelType ) : String

Builds model localization scope by it's namespace and type ([AreaName.]Models.{Namespace}.{TypeName}).

GetModelSpecificMessagesScope ( Type modelType, String propertyName ) : String

Gets the model specific error messages localization scope.

GetPartialViewScope ( System.Web.Mvc.ViewContext viewContext, String partialViewName ) : String

Builds partial view localization scope by view path (removes leading Areas directory).

GetResourceString ( System.Web.HttpContextBase context, String key, String scope, CultureInfo culture, Func translationMissing ) : String

Gets resource String using specified scope, key and culture.

translationMissing handler will be called if resource can not be found.

GetViewScope ( String viewPath ) : String

Builds view localization scope by view path (removes leading Areas directory).

GetViewScope ( System.Web.Mvc.ViewContext viewContext ) : String

Builds view localization scope by view path (removes leading Areas directory).

TranslateErrorMessage ( System.Web.HttpContextBase context, Type modelType, String propertyName, String validatorKey ) : String

Translates validation error message.

TranslateErrorMessage ( System.Web.HttpContextBase context, Type modelType, String propertyName, String validatorKey, String validationParams ) : String

Translates the error message and replace params.

TranslatePropertyName ( System.Web.HttpContextBase context, Type modelType, String propertyName ) : String

Translates property name using model scope.

Приватные методы

Метод Описание
GetPartialViewPath ( System.Web.Mvc.ViewContext viewContext, String partialViewName ) : String

Описание методов

Combine() публичный статический Метод

Generates resource key from chains.
public static Combine ( ) : String
Результат String

Combine() публичный статический Метод

Generates resource key from chains.
public static Combine ( IEnumerable chains ) : String
chains IEnumerable The chains.
Результат String

GetCommonMessagesScope() публичный статический Метод

Gets the common error messages localization scope.
public static GetCommonMessagesScope ( ) : String
Результат String

GetControllerScope() публичный статический Метод

Builds controller localization scope by it's namespace and type ([AreaName.]Controllers.{ControllerName}).
public static GetControllerScope ( Controller controller ) : String
controller Controller The controller.
Результат String

GetControllerScope() публичный статический Метод

Gets the controller scope.
public static GetControllerScope ( String areaName, String controllerName ) : String
areaName String Name of the area.
controllerName String Name of the controller.
Результат String

GetModelScope() публичный статический Метод

Builds model localization scope by it's namespace and type ([AreaName.]Models.{Namespace}.{TypeName}).
public static GetModelScope ( Type modelType ) : String
modelType System.Type Type of the model.
Результат String

GetModelSpecificMessagesScope() публичный статический Метод

Gets the model specific error messages localization scope.
public static GetModelSpecificMessagesScope ( Type modelType, String propertyName ) : String
modelType System.Type Type of the model.
propertyName String Name of the property.
Результат String

GetPartialViewScope() публичный статический Метод

Builds partial view localization scope by view path (removes leading Areas directory).
public static GetPartialViewScope ( System.Web.Mvc.ViewContext viewContext, String partialViewName ) : String
viewContext System.Web.Mvc.ViewContext The view context.
partialViewName String Name of partial view.
Результат String

GetResourceString() публичный статический Метод

Gets resource String using specified scope, key and culture.
translationMissing handler will be called if resource can not be found.
public static GetResourceString ( System.Web.HttpContextBase context, String key, String scope, CultureInfo culture, Func translationMissing ) : String
context System.Web.HttpContextBase The http context.
key String The resource key.
scope String The localization scope.
culture System.Globalization.CultureInfo The culture.
translationMissing Func Translation missing fallback.
Результат String

GetViewScope() публичный статический Метод

Builds view localization scope by view path (removes leading Areas directory).
public static GetViewScope ( String viewPath ) : String
viewPath String The view path.
Результат String

GetViewScope() публичный статический Метод

Builds view localization scope by view path (removes leading Areas directory).
public static GetViewScope ( System.Web.Mvc.ViewContext viewContext ) : String
viewContext System.Web.Mvc.ViewContext The view context.
Результат String

TranslateErrorMessage() публичный статический Метод

Translates validation error message.
public static TranslateErrorMessage ( System.Web.HttpContextBase context, Type modelType, String propertyName, String validatorKey ) : String
context System.Web.HttpContextBase The http context.
modelType System.Type Type of the model.
propertyName String Name of the property.
validatorKey String The validator key.
Результат String

TranslateErrorMessage() публичный статический Метод

Translates the error message and replace params.
public static TranslateErrorMessage ( System.Web.HttpContextBase context, Type modelType, String propertyName, String validatorKey, String validationParams ) : String
context System.Web.HttpContextBase The context.
modelType System.Type Type of the model.
propertyName String Name of the property.
validatorKey String The validator key.
validationParams String The validation params.
Результат String

TranslatePropertyName() публичный статический Метод

Translates property name using model scope.
public static TranslatePropertyName ( System.Web.HttpContextBase context, Type modelType, String propertyName ) : String
context System.Web.HttpContextBase The http context.
modelType System.Type Type of the model.
propertyName String Name of the proprty.
Результат String

Описание свойств

Areas публичное статическое свойство

Areas constant.
public static String Areas
Результат String

MainAreas публичное статическое свойство

Areas built in framework.
public static String[] MainAreas
Результат String[]

ScopeSeparator публичное статическое свойство

Resources scope separator.
public static String ScopeSeparator
Результат String

SlashSeparator публичное статическое свойство

Slash separator.
public static char SlashSeparator
Результат char

ViewScopeKey публичное статическое свойство

View scope key.
public static String ViewScopeKey
Результат String