C# Class Serenity.LocalText

Exibir arquivo Open project: volkanceylan/Serenity Class Usage Examples

Public Properties

Property Type Description
Empty LocalText

Public Methods

Method 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

Method Description
LocalText ( ) : Serenity.Abstractions

Method Details

Add() public static method

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
return void

Get() public method

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

Get() public static method

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
return string

GetDefault() public static method

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
return string

InitializeTextClass() public static method

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.")
return void

LocalText() public method

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

LocalText() public method

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

ToString() public method

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

TryGet() public static method

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
return string

Property Details

Empty public_oe static_oe property

An empty local text instance like String.Empty
public static LocalText,Serenity Empty
return LocalText