Show / Hide Table of Contents

Class StringTable

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(Stream), 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.

Inheritance
System.Object
StringTable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: CADability.UserInterface
Assembly: CADability.dll
Syntax
public class StringTable

Properties

| Improve this Doc View Source

ActiveLanguage

Gets or sets the active language

Declaration
public static string ActiveLanguage { get; set; }
Property Value
Type Description
System.String

Methods

| Improve this Doc View Source

AddString(String, String, StringTable.Category, String)

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

Declaration
public static void AddString(string language, string resourceID, StringTable.Category cat, string text)
Parameters
Type Name Description
System.String language

the language of the string

System.String resourceID

the ID of the string

StringTable.Category cat
System.String text

the string

Remarks

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

| Improve this Doc View Source

AddStrings(Stream)

Declaration
public static void AddStrings(Stream str)
Parameters
Type Name Description
System.IO.Stream str
| Improve this Doc View Source

AddStrings(XmlDocument)

Declaration
public static void AddStrings(XmlDocument doc)
Parameters
Type Name Description
System.Xml.XmlDocument doc
| Improve this Doc View Source

Dispose()

Declaration
public static void Dispose()
| Improve this Doc View Source

GetFormattedString(String, 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.

Declaration
public static string GetFormattedString(string Name, params object[] args)
Parameters
Type Name Description
System.String Name

Name or ID of the string

System.Object[] args

Variable number of arguments for formatting

Returns
Type Description
System.String

The formatted string

| Improve this Doc View Source

GetLanguageNames()

Declaration
public static string[] GetLanguageNames()
Returns
Type Description
System.String[]
| Improve this Doc View Source

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.

Declaration
public static string[] GetSplittedStrings(string Name)
Parameters
Type Name Description
System.String Name

Name or ID of the string

Returns
Type Description
System.String[]

The exploded string

| Improve this Doc View Source

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.

Declaration
public static string GetString(string Name)
Parameters
Type Name Description
System.String Name

Name or ID of the string

Returns
Type Description
System.String

the value of the string entry

| Improve this Doc View Source

GetString(String, StringTable.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.

Declaration
public static string GetString(string Name, StringTable.Category cat)
Parameters
Type Name Description
System.String Name

Name or ID of the string

StringTable.Category cat

the Category of the required string

Returns
Type Description
System.String

the value of the string entry

| Improve this Doc View Source

IsStringDefined(String)

Declaration
public static bool IsStringDefined(string Name)
Parameters
Type Name Description
System.String Name
Returns
Type Description
System.Boolean
| Improve this Doc View Source

SetActiveLanguage(Int32)

Declaration
public static void SetActiveLanguage(int index)
Parameters
Type Name Description
System.Int32 index

Events

| Improve this Doc View Source

ActiveLanguageChangedEvent

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

Declaration
public static event StringTable.ActiveLanguageChangedDelegate ActiveLanguageChangedEvent
Event Type
Type Description
StringTable.ActiveLanguageChangedDelegate
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX