A collection of LocalizableStrings with language-search methods.
More...
|
void | Add ([Localizable(false)] string language, string? value) |
| Adds a new string with an associated language to the collection. More...
|
|
void | Add (string value) |
| Adds a new en string to the collection. More...
|
|
bool | ContainsExactLanguage (CultureInfo language) |
| Checks if the collection contains an entry exactly matching the specified language. More...
|
|
string? | GetExactLanguage (CultureInfo language) |
| Returns the first string in the collection exactly matching the specified language. More...
|
|
string? | GetBestLanguage (CultureInfo language) |
| Returns the best-fitting string in the collection for the specified language. More...
|
|
void | Set (CultureInfo language, string? value) |
| Adds a new string with an associated language to the collection. Preexisting entries with the same language are removed. More...
|
|
LocalizableStringCollection | Clone () |
| Creates a deep copy of this LocalizableStringCollection (elements are cloned). More...
|
|
T | Clone () |
| Creates a new clone of this instance. More...
|
|
A collection of LocalizableStrings with language-search methods.
◆ Add() [1/2]
void NanoByte.Common.Collections.LocalizableStringCollection.Add |
( |
[Localizable(false)] string |
language, |
|
|
string? |
value |
|
) |
| |
|
inline |
Adds a new string with an associated language to the collection.
- Parameters
-
language | The language of the value . |
value | The actual string value to store. |
◆ Add() [2/2]
void NanoByte.Common.Collections.LocalizableStringCollection.Add |
( |
string |
value | ) |
|
Adds a new en
string to the collection.
- Parameters
-
value | The actual string value to store. |
◆ Clone()
◆ ContainsExactLanguage()
bool NanoByte.Common.Collections.LocalizableStringCollection.ContainsExactLanguage |
( |
CultureInfo |
language | ) |
|
|
inline |
Checks if the collection contains an entry exactly matching the specified language.
- Parameters
-
language | The exact language to look for. |
- Returns
true
if an element with the specified language exists in the collection; false
otherwise.
- See also
- GetExactLanguage
◆ GetBestLanguage()
string? NanoByte.Common.Collections.LocalizableStringCollection.GetBestLanguage |
( |
CultureInfo |
language | ) |
|
|
inline |
Returns the best-fitting string in the collection for the specified language.
- Parameters
-
language | The language to look for. |
- Returns
- The best-fitting string value found in the collection;
null
if the collection is empty.
Language preferences in decreasing order:
- exact match
- same language with neutral culture
- en
- en-US
- first entry in collection
◆ GetExactLanguage()
string? NanoByte.Common.Collections.LocalizableStringCollection.GetExactLanguage |
( |
CultureInfo |
language | ) |
|
|
inline |
Returns the first string in the collection exactly matching the specified language.
- Parameters
-
language | The exact language to look for. |
- Returns
- The string value found in the collection;
null
if none was found.
- See also
- ContainsExactLanguage
◆ Set()
void NanoByte.Common.Collections.LocalizableStringCollection.Set |
( |
CultureInfo |
language, |
|
|
string? |
value |
|
) |
| |
|
inline |
Adds a new string with an associated language to the collection. Preexisting entries with the same language are removed.
- Parameters
-
language | The language of the value . |
value | The actual string value to store; null to remove existing entries. |
The documentation for this class was generated from the following file:
- Common/Collections/LocalizableStringCollection.cs