Wrench.LanguageSet Class Reference

Detailed Description

A set of variables for a particular language. Used for localization.

Inheritance diagram for Wrench.LanguageSet:
Wrench.VariableSet

Public Member Functions

 LanguageSet ()
 Creates a new empty language set. More...
 
 LanguageSet (string content, LanguageLoader loader)
 Creates a new language set, loading its content from the given xml string. More...
 
 LanguageSet (string content)
 Creates a new language set, loading its content from the given xml string. More...
 
 LanguageSet (string content, string group)
 Creates a new language set, loading its content from the given xml string. More...
 
void SetContent (string content)
 Sets the content of this language from a given xml string. More...
 
bool ContainsGroup (string group)
 Does this set contain the named group? More...
 
LanguageSet LoadGroup (string groupName)
 Loads the group with the given name using this sets loader, if there is one. More...
 
LanguageSet AddGroup (string content)
 Adds the group from the given text. This allows loading new language variables at runtime. More...
 
LanguageSet AddGroup (string content, string group)
 Adds the group from the given text. This allows loading new language variables at runtime. More...
 
void AddGroup (LanguageSet group)
 Adds the given group to this set. This allows loading new language variables at runtime. More...
 
void RemoveGroup (string group)
 Removes a group from this language. More...
 
override string GetValue (string code)
 Gets the value of the named variable from this set. More...
 
- Public Member Functions inherited from Wrench.VariableSet
 VariableSet ()
 Creates a new empty variable set. More...
 
void Clear ()
 Empties this variable set. More...
 
void Add (string code, string value)
 Adds a variable to this set. More...
 
void Remove (string code)
 Removes a variable by name. More...
 
bool Contains (string code)
 Checks if this variable set contains the named variable. More...
 
virtual void SetValue (string code, string value)
 Sets a value of the named variable into this set. Creates it if it doesn't exist. More...
 

Public Attributes

string Name
 The name of the language. More...
 
string Code
 The language code, e.g. "en". Always lowercase. More...
 
string Group
 A group, if any. This will either come from the language tag or be provided in a constructor. It gets appended to all variable names in the set and defines a set of variables, such as all those found on the login page. Grouped variables let you break it down into multiple files. They are accessed with &groupname.varname; More...
 
bool GoesLeftwards
 True if this language goes from right to left (e.g. arabic). More...
 
LanguageLoader Loader
 The language loader (if any) used to load this set. More...
 
GroupResolve OnGroupResolve
 A delegate called when a group gets resolved from a variable but isn't found in ExtraGroups. More...
 
Dictionary< string, LanguageSetExtraGroups
 A set of additional groups. More...
 
- Public Attributes inherited from Wrench.VariableSet
Dictionary< string, string > Map
 The lookup of variable name to its content. More...
 

Additional Inherited Members

- Properties inherited from Wrench.VariableSet
string this[string code] [get, set]
 Gets or sets (or creates if not found) the value of a named variable in this set. More...
 

Constructor & Destructor Documentation

Wrench.LanguageSet.LanguageSet ( )
inline

Creates a new empty language set.

Wrench.LanguageSet.LanguageSet ( string  content,
LanguageLoader  loader 
)
inline

Creates a new language set, loading its content from the given xml string.

Parameters
contentAn xml formatted string of all the variables in this language.
loaderThe optional loader which loaded this set.
groupA group that these language variables belong to.
Wrench.LanguageSet.LanguageSet ( string  content)
inline

Creates a new language set, loading its content from the given xml string.

Parameters
contentAn xml formatted string of all the variables in this language.
groupA group that these language variables belong to.
Wrench.LanguageSet.LanguageSet ( string  content,
string  group 
)
inline

Creates a new language set, loading its content from the given xml string.

Parameters
contentAn xml formatted string of all the variables in this language.
groupA group that these language variables belong to.

Member Function Documentation

LanguageSet Wrench.LanguageSet.AddGroup ( string  content)
inline

Adds the group from the given text. This allows loading new language variables at runtime.

Parameters
contentThe xml structured variables.
LanguageSet Wrench.LanguageSet.AddGroup ( string  content,
string  group 
)
inline

Adds the group from the given text. This allows loading new language variables at runtime.

Parameters
contentThe xml structured variables.
groupThe name of the group.
void Wrench.LanguageSet.AddGroup ( LanguageSet  group)
inline

Adds the given group to this set. This allows loading new language variables at runtime.

Parameters
groupThe group to add.
bool Wrench.LanguageSet.ContainsGroup ( string  group)
inline

Does this set contain the named group?

Returns
True if it does; false otherwise.
override string Wrench.LanguageSet.GetValue ( string  code)
inlinevirtual

Gets the value of the named variable from this set.

Parameters
codeThe name of the variable to get the value of.
Returns
The value of the variable; null if it wasn't found.

Reimplemented from Wrench.VariableSet.

LanguageSet Wrench.LanguageSet.LoadGroup ( string  groupName)
inline

Loads the group with the given name using this sets loader, if there is one.

void Wrench.LanguageSet.RemoveGroup ( string  group)
inline

Removes a group from this language.

Parameters
groupThe name of the group to remove.
void Wrench.LanguageSet.SetContent ( string  content)
inline

Sets the content of this language from a given xml string.

Parameters
contentAn xml formatted string of all the variables in this language.

Member Data Documentation

string Wrench.LanguageSet.Code

The language code, e.g. "en". Always lowercase.

Dictionary<string,LanguageSet> Wrench.LanguageSet.ExtraGroups

A set of additional groups.

bool Wrench.LanguageSet.GoesLeftwards

True if this language goes from right to left (e.g. arabic).

string Wrench.LanguageSet.Group

A group, if any. This will either come from the language tag or be provided in a constructor. It gets appended to all variable names in the set and defines a set of variables, such as all those found on the login page. Grouped variables let you break it down into multiple files. They are accessed with &groupname.varname;

LanguageLoader Wrench.LanguageSet.Loader

The language loader (if any) used to load this set.

string Wrench.LanguageSet.Name

The name of the language.

GroupResolve Wrench.LanguageSet.OnGroupResolve

A delegate called when a group gets resolved from a variable but isn't found in ExtraGroups.