C# Class NGettext.Catalog

Represents a Gettext catalog instance. Loads translations from gettext *.mo files.
Inheritance: NGettext.BaseCatalog
Show file Open project: neris/NGettext Class Usage Examples

Public Methods

Method Description
Catalog ( ) : System

Initializes a new instance of the Catalog class that has no translations using the current UI culture info and plural rule generated by DefaultPluralRuleGenerator for the current UI culture.

Catalog ( CultureInfo cultureInfo ) : System

Initializes a new instance of the Catalog class that has no translations using given culture info and plural rule generated by DefaultPluralRuleGenerator for given culture.

Catalog ( ILoader loader ) : System

Initializes a new instance of the Catalog class using the current UI culture info and loads data using given loader.

Catalog ( ILoader loader, CultureInfo cultureInfo ) : System

Initializes a new instance of the Catalog class using given culture info and loads data using given loader.

Catalog ( Stream moStream ) : System

Initializes a new instance of the Catalog class using the current UI culture info and loads data from specified stream using a new MoLoader instance.

Catalog ( Stream moStream, CultureInfo cultureInfo ) : System

Initializes a new instance of the Catalog class using given culture info and loads data from specified stream using a new MoLoader instance.

Catalog ( string domain, string localeDir ) : System

Initializes a new instance of the Catalog class using the current UI culture info and loads data for specified domain and locale directory using a new MoLoader instance.

Catalog ( string domain, string localeDir, CultureInfo cultureInfo ) : System

Initializes a new instance of the Catalog class using given culture info and loads data for specified domain and locale directory using a new MoLoader instance.

GetParticularPluralString ( string context, string text, string pluralText, long n ) : string

Returns the plural form for n of the translation of text using given context. Similar to npgettext function.

GetParticularString ( string context, string text ) : string

Returns text translated into the selected language using given context. Similar to pgettext function.

GetPluralString ( string text, string pluralText, long n ) : string

Returns the plural form for n of the translation of text. Similar to ngettext function.

GetPluralStringDefault ( string messageId, string defaultMessage, string defaultPluralMessage, long n ) : string

Returns translated plural string for given messageId or defaultMessage or defaultPluralMessage on fail.

GetString ( string text ) : string

Returns text translated into the selected language. Similar to gettext function.

GetStringDefault ( string messageId, string defaultMessage ) : string

Returns translated string for given messageId or defaultMessage on fail.

GetTranslations ( string messageId ) : string[]

Returns all translations for given messageId.

Load ( ILoader loader ) : void

Loads data to the current catalog using specified loader instance.

Method Details

Catalog() public method

Initializes a new instance of the Catalog class that has no translations using the current UI culture info and plural rule generated by DefaultPluralRuleGenerator for the current UI culture.
public Catalog ( ) : System
return System

Catalog() public method

Initializes a new instance of the Catalog class that has no translations using given culture info and plural rule generated by DefaultPluralRuleGenerator for given culture.
public Catalog ( CultureInfo cultureInfo ) : System
cultureInfo System.Globalization.CultureInfo Culture info.
return System

Catalog() public method

Initializes a new instance of the Catalog class using the current UI culture info and loads data using given loader.
public Catalog ( ILoader loader ) : System
loader ILoader Loader instance.
return System

Catalog() public method

Initializes a new instance of the Catalog class using given culture info and loads data using given loader.
public Catalog ( ILoader loader, CultureInfo cultureInfo ) : System
loader ILoader Loader instance.
cultureInfo System.Globalization.CultureInfo Culture info.
return System

Catalog() public method

Initializes a new instance of the Catalog class using the current UI culture info and loads data from specified stream using a new MoLoader instance.
public Catalog ( Stream moStream ) : System
moStream Stream Stream that contain binary data in the MO file format.
return System

Catalog() public method

Initializes a new instance of the Catalog class using given culture info and loads data from specified stream using a new MoLoader instance.
public Catalog ( Stream moStream, CultureInfo cultureInfo ) : System
moStream Stream Stream that contain binary data in the MO file format.
cultureInfo System.Globalization.CultureInfo Culture info.
return System

Catalog() public method

Initializes a new instance of the Catalog class using the current UI culture info and loads data for specified domain and locale directory using a new MoLoader instance.
public Catalog ( string domain, string localeDir ) : System
domain string Catalog domain name.
localeDir string Directory that contains gettext localization files.
return System

Catalog() public method

Initializes a new instance of the Catalog class using given culture info and loads data for specified domain and locale directory using a new MoLoader instance.
public Catalog ( string domain, string localeDir, CultureInfo cultureInfo ) : System
domain string Catalog domain name.
localeDir string Directory that contains gettext localization files.
cultureInfo System.Globalization.CultureInfo Culture info.
return System

GetParticularPluralString() public method

Returns the plural form for n of the translation of text using given context. Similar to npgettext function.
public GetParticularPluralString ( string context, string text, string pluralText, long n ) : string
context string Context.
text string Singular form of message to translate.
pluralText string Plural form of message to translate.
n long Value that determines the plural form.
return string

GetParticularString() public method

Returns text translated into the selected language using given context. Similar to pgettext function.
public GetParticularString ( string context, string text ) : string
context string Context.
text string Text to translate.
return string

GetPluralString() public method

Returns the plural form for n of the translation of text. Similar to ngettext function.
public GetPluralString ( string text, string pluralText, long n ) : string
text string Singular form of message to translate.
pluralText string Plural form of message to translate.
n long Value that determines the plural form.
return string

GetPluralStringDefault() public method

Returns translated plural string for given messageId or defaultMessage or defaultPluralMessage on fail.
public GetPluralStringDefault ( string messageId, string defaultMessage, string defaultPluralMessage, long n ) : string
messageId string Message ID
defaultMessage string Default message singular form
defaultPluralMessage string Default message plural form
n long Value that determines the plural form
return string

GetString() public method

Returns text translated into the selected language. Similar to gettext function.
public GetString ( string text ) : string
text string Text to translate.
return string

GetStringDefault() public method

Returns translated string for given messageId or defaultMessage on fail.
public GetStringDefault ( string messageId, string defaultMessage ) : string
messageId string Message ID
defaultMessage string Default message
return string

GetTranslations() public method

Returns all translations for given messageId.
public GetTranslations ( string messageId ) : string[]
messageId string
return string[]

Load() public method

Loads data to the current catalog using specified loader instance.
public Load ( ILoader loader ) : void
loader ILoader Loader instance.
return void