Class LocalizableStringCollection
A collection of LocalizableStrings with language-search methods.
Implements
Namespace: NanoByte.Common.Collections
Assembly: NanoByte.Common.dll
Syntax
public class LocalizableStringCollection : List<LocalizableString>, ICloneable<LocalizableStringCollection>
Constructors
LocalizableStringCollection()
Declaration
public LocalizableStringCollection()
Methods
Add(String)
Adds a new en
string to the collection.
Declaration
public void Add(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The actual string value to store. |
Add(String, String)
Adds a new string with an associated language to the collection.
Declaration
public void Add(string language, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | language | The language of the |
System.String | value | The actual string value to store. |
Clone()
Creates a deep copy of this LocalizableStringCollection (elements are cloned).
Declaration
public LocalizableStringCollection Clone()
Returns
Type | Description |
---|---|
LocalizableStringCollection | The cloned LocalizableStringCollection. |
ContainsExactLanguage(CultureInfo)
Checks if the collection contains an entry exactly matching the specified language.
Declaration
public bool ContainsExactLanguage(CultureInfo language)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | language | The exact language to look for. |
Returns
Type | Description |
---|---|
Boolean |
|
See Also
GetBestLanguage(CultureInfo)
Returns the best-fitting string in the collection for the specified language.
Declaration
public string GetBestLanguage(CultureInfo language)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | language | The language to look for. |
Returns
Type | Description |
---|---|
System.String | The best-fitting string value found in the collection; |
Remarks
Language preferences in decreasing order:
- exact match
- same language with neutral culture
- en
- en-US
- first entry in collection
GetExactLanguage(CultureInfo)
Returns the first string in the collection exactly matching the specified language.
Declaration
public string GetExactLanguage(CultureInfo language)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | language | The exact language to look for. |
Returns
Type | Description |
---|---|
System.String | The string value found in the collection; |
See Also
Set(CultureInfo, String)
Adds a new string with an associated language to the collection. Preexisting entries with the same language are removed.
Declaration
public void Set(CultureInfo language, string value)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | language | The language of the |
System.String | value | The actual string value to store; |