Table of Contents

Class StringTable

Namespace
CADability.UserInterface
Assembly
CADability.dll

StringTable is a class that returns language dependent strings from (hard-coded) string IDs. All language dependent user interface texts are processed here. CADability contains an XML file as a primary string resource, containing all user interface texts in German and English language. You can Add more strings and more languages by calling AddStrings(XmlDocument), or by simply providing an XML file named "CADability.StringTable.xxx.xml" (where xxx stands for any language or application specific abbreviation) in the directory where CADability.dll is located.

public class StringTable
Inheritance
StringTable
Inherited Members

Constructors

StringTable()

public StringTable()

Properties

ActiveLanguage

Gets or sets the active language

public static string ActiveLanguage { get; set; }

Property Value

string

Methods

AddString(string, string, Category, string)

Adds a single string to the Stringtable. This can be used for adding new strings or overriding existing strings.

public static void AddString(string language, string resourceID, StringTable.Category cat, string text)

Parameters

language string

the language of the string

resourceID string

the ID of the string

cat StringTable.Category

the category of the string (label, info or tip)

text string

the string

AddStrings(Stream)

public static void AddStrings(Stream str)

Parameters

str Stream

AddStrings(XmlDocument)

Adds the strings of the given xml document to the string table.

public static void AddStrings(XmlDocument doc)

Parameters

doc XmlDocument

xml document to parse

Remarks

See file "StringTable.xml" for the required xml schema.

Dispose()

public static void Dispose()

GetFormattedString(string, params object[])

Returns a formatted string. The string with the ID "Name" from the string resource is formatted by substituting the {0}, {1} ... substring with the string values of the args objects. If there is a formatting error, the unformatted string will be returned.

public static string GetFormattedString(string Name, params object[] args)

Parameters

Name string

Name or ID of the string

args object[]

Variable number of arguments for formatting

Returns

string

The formatted string

GetLanguageNames()

public static string[] GetLanguageNames()

Returns

string[]

GetSplittedStrings(string)

Returns an array of strings from the string table. The array is created from a single entry in the string table. The first character of this entry is the separator and the remaining string is splitted by this separator.

public static string[] GetSplittedStrings(string Name)

Parameters

Name string

Name or ID of the string

Returns

string[]

The exploded string

GetString(string)

--- Depricated --- use GetString(string, Category) instead. Returns the string with the given ID in the ActiveLanguage. If the there is no appropriate entry in the ActiveLanguage then the default language is searched. If there is still no entry "missing string: "+Name is returned.

public static string GetString(string Name)

Parameters

Name string

Name or ID of the string

Returns

string

the value of the string entry

GetString(string, Category)

Returns the string with the given ID and the given StringTable.Categoryin the ActiveLanguage. If the there is no appropriate entry in the ActiveLanguage then the default language is searched. If there is still no entry "missing string: "+Name is returned.

public static string GetString(string Name, StringTable.Category cat)

Parameters

Name string

Name or ID of the string

cat StringTable.Category

the Category of the required string

Returns

string

the value of the string entry

IsStringDefined(string)

public static bool IsStringDefined(string Name)

Parameters

Name string

Returns

bool

SetActiveLanguage(int)

public static void SetActiveLanguage(int index)

Parameters

index int

Events

ActiveLanguageChangedEvent

Event which is fired when the active languae of the user interface is changed

public static event StringTable.ActiveLanguageChangedDelegate ActiveLanguageChangedEvent

Event Type

StringTable.ActiveLanguageChangedDelegate