C# Class Framework.Mvc.Helpers.ResourceHelper

Provides methods for resources retrieving.
Afficher le fichier Open project: coreframework/Core-Framework

Méthodes publiques

Свойство Type Description
Areas String
MainAreas String[]
ScopeSeparator String
SlashSeparator char
ViewScopeKey String

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
GetPartialViewPath ( System.Web.Mvc.ViewContext viewContext, String partialViewName ) : String

Method Details

Combine() public static méthode

Generates resource key from chains.
public static Combine ( ) : String
Résultat String

Combine() public static méthode

Generates resource key from chains.
public static Combine ( IEnumerable chains ) : String
chains IEnumerable The chains.
Résultat String

GetCommonMessagesScope() public static méthode

Gets the common error messages localization scope.
public static GetCommonMessagesScope ( ) : String
Résultat String

GetControllerScope() public static méthode

Builds controller localization scope by it's namespace and type ([AreaName.]Controllers.{ControllerName}).
public static GetControllerScope ( Controller controller ) : String
controller Controller The controller.
Résultat String

GetControllerScope() public static méthode

Gets the controller scope.
public static GetControllerScope ( String areaName, String controllerName ) : String
areaName String Name of the area.
controllerName String Name of the controller.
Résultat String

GetModelScope() public static méthode

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.
Résultat String

GetModelSpecificMessagesScope() public static méthode

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.
Résultat String

GetPartialViewScope() public static méthode

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.
Résultat String

GetResourceString() public static méthode

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.
Résultat String

GetViewScope() public static méthode

Builds view localization scope by view path (removes leading Areas directory).
public static GetViewScope ( String viewPath ) : String
viewPath String The view path.
Résultat String

GetViewScope() public static méthode

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.
Résultat String

TranslateErrorMessage() public static méthode

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.
Résultat String

TranslateErrorMessage() public static méthode

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.
Résultat String

TranslatePropertyName() public static méthode

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.
Résultat String

Property Details

Areas public_oe static_oe property

Areas constant.
public static String Areas
Résultat String

MainAreas public_oe static_oe property

Areas built in framework.
public static String[] MainAreas
Résultat String[]

ScopeSeparator public_oe static_oe property

Resources scope separator.
public static String ScopeSeparator
Résultat String

SlashSeparator public_oe static_oe property

Slash separator.
public static char SlashSeparator
Résultat char

ViewScopeKey public_oe static_oe property

View scope key.
public static String ViewScopeKey
Résultat String