C# Class Serenity.LocalText

Afficher le fichier Open project: volkanceylan/Serenity Class Usage Examples

Méthodes publiques

Свойство Type Description
Empty LocalText

Méthodes publiques

Méthode Description
Add ( object>.JsDictionary obj, string prefix ) : void

Use to add local text to dictionary

Obj is provided in a compact format to keep size as small as possible.

Get ( ) : string

Converts the text key, local text object contains to its textual representation.

Get ( string key ) : string

Returns localized representation which corresponds to the local text key or the key itself if none found in local text registry.

GetDefault ( string key, string defaultText ) : string

Tries to get localized text or if not found, default

InitializeTextClass ( Type type, string prefix ) : void

Initializes a static class that contains static LocalText objects. These objects actually contains localized texts in default language, but this method adds them to local text dictionary and replaces their values with text keys generated from concatting a prefix and the variable name.

LocalText ( string key ) : Serenity.Abstractions

Creates a new LocalText instance that contains the specified local text key

LocalText ( string key ) : System

Creates a new local text object containing the given key.

ToString ( ) : string

Returns localized representation which corresponds to the local text key or the key itself if none found in local text registry.

TryGet ( string key ) : string

Returns localized representation which corresponds to the local text key or NULL if none found in local text registry.

Private Methods

Méthode Description
LocalText ( ) : Serenity.Abstractions

Method Details

Add() public static méthode

Use to add local text to dictionary
Obj is provided in a compact format to keep size as small as possible.
public static Add ( object>.JsDictionary obj, string prefix ) : void
obj object>.JsDictionary Object with local text list in a format like Enums:{WeekDays:{Monday: 'Pazartesi', ... }}} to /// "Enums.WeekDays.Monday" = "Pazartesi"
prefix string Prefix to add to all keys
Résultat void

Get() public méthode

Converts the text key, local text object contains to its textual representation.
public Get ( ) : string
Résultat string

Get() public static méthode

Returns localized representation which corresponds to the local text key or the key itself if none found in local text registry.
public static Get ( string key ) : string
key string
Résultat string

GetDefault() public static méthode

Tries to get localized text or if not found, default
public static GetDefault ( string key, string defaultText ) : string
key string Text key
defaultText string Default text
Résultat string

InitializeTextClass() public static méthode

Initializes a static class that contains static LocalText objects. These objects actually contains localized texts in default language, but this method adds them to local text dictionary and replaces their values with text keys generated from concatting a prefix and the variable name.
public static InitializeTextClass ( Type type, string prefix ) : void
type System.Type Type to initialize that contains texts
prefix string Prefix to add text keys (e.g. "Db.SomeCategory.")
Résultat void

LocalText() public méthode

Creates a new LocalText instance that contains the specified local text key
public LocalText ( string key ) : Serenity.Abstractions
key string Local text key
Résultat Serenity.Abstractions

LocalText() public méthode

Creates a new local text object containing the given key.
public LocalText ( string key ) : System
key string
Résultat System

ToString() public méthode

Returns localized representation which corresponds to the local text key or the key itself if none found in local text registry.
public ToString ( ) : string
Résultat string

TryGet() public static méthode

Returns localized representation which corresponds to the local text key or NULL if none found in local text registry.
public static TryGet ( string key ) : string
key string
Résultat string

Property Details

Empty public_oe static_oe property

An empty local text instance like String.Empty
public static LocalText,Serenity Empty
Résultat LocalText