Show / Hide Table of Contents

Class MultilingualString

Represents a string that may defined in multiple languages.

Inheritance
Object
Dictionary<String, String>
MultilingualString
Implements
IDictionary<String, String>
ICollection<KeyValuePair<String, String>>
IDictionary
ICollection
IReadOnlyDictionary<String, String>
IReadOnlyCollection<KeyValuePair<String, String>>
IEnumerable<KeyValuePair<String, String>>
IEnumerable
ISerializable
IDeserializationCallback
INotifyPropertyChanged
Inherited Members
Dictionary<String, String>.Add(String, String)
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String, System.String>>.Add(System.Collections.Generic.KeyValuePair<System.String, System.String>)
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String, System.String>>.Contains(System.Collections.Generic.KeyValuePair<System.String, System.String>)
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String, System.String>>.Remove(System.Collections.Generic.KeyValuePair<System.String, System.String>)
Dictionary<String, String>.Clear()
Dictionary<String, String>.ContainsKey(String)
Dictionary<String, String>.ContainsValue(String)
Dictionary<String, String>.GetEnumerator()
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.String>>.GetEnumerator()
Dictionary<String, String>.GetObjectData(SerializationInfo, StreamingContext)
Dictionary<String, String>.OnDeserialization(Object)
Dictionary<String, String>.Remove(String)
Dictionary<String, String>.TryGetValue(String, String)
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String, System.String>>.CopyTo(System.Collections.Generic.KeyValuePair<System.String, System.String>[], System.Int32)
Dictionary<String, String>.ICollection.CopyTo(Array, Int32)
Dictionary<String, String>.IEnumerable.GetEnumerator()
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.IDictionary.get_Item(System.Object)
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.IDictionary.set_Item(System.Object, System.Object)
Dictionary<String, String>.IDictionary.Add(Object, Object)
Dictionary<String, String>.IDictionary.Contains(Object)
Dictionary<String, String>.IDictionary.GetEnumerator()
Dictionary<String, String>.IDictionary.Remove(Object)
Dictionary<String, String>.Comparer
Dictionary<String, String>.Count
Dictionary<String, String>.Keys
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.Generic.IDictionary<System.String, System.String>.Keys
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.Generic.IReadOnlyDictionary<System.String, System.String>.Keys
Dictionary<String, String>.Values
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.Generic.IDictionary<System.String, System.String>.Values
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.Generic.IReadOnlyDictionary<System.String, System.String>.Values
Dictionary<String, String>.Item[String]
System.Collections.Generic.Dictionary<System.String, System.String>.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String, System.String>>.IsReadOnly
Dictionary<String, String>.ICollection.IsSynchronized
Dictionary<String, String>.ICollection.SyncRoot
Dictionary<String, String>.IDictionary.IsFixedSize
Dictionary<String, String>.IDictionary.IsReadOnly
Dictionary<String, String>.IDictionary.Keys
Dictionary<String, String>.IDictionary.Values
Dictionary<String, String>.IDictionary.Item[Object]
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: Algenta.Colectica.Model.Utility
Assembly: Algenta.Colectica.Model.dll
Syntax
public class MultilingualString : Dictionary<string, string>, IDictionary<string, string>, ICollection<KeyValuePair<string, string>>, IDictionary, ICollection, IReadOnlyDictionary<string, string>, IReadOnlyCollection<KeyValuePair<string, string>>, IEnumerable<KeyValuePair<string, string>>, IEnumerable, ISerializable, IDeserializationCallback, INotifyPropertyChanged

Constructors

MultilingualString()

Initializes a new instance of the MultilingualString class.

Declaration
public MultilingualString()

MultilingualString(String)

Initializes a new instance of the MultilingualString class.

Declaration
public MultilingualString(string value)
Parameters
Type Name Description
String value

A value to be assigned for the current culture.

MultilingualString(String, String)

Initializes a new instance of the MultilingualString class.

Declaration
public MultilingualString(string value, string culture)
Parameters
Type Name Description
String value

A value to be assigned for the specified culture.

String culture

The culture to which the specified value should be applied.

Properties

Best

Gets the best string, according to the SortOrder.

Declaration
public string Best { get; }
Property Value
Type Description
String

The best.

BestCulture

Gets the best culture, according to the SortOrder.

Declaration
public string BestCulture { get; }
Property Value
Type Description
String

The best culture.

BestPlainText

Gets the best string, according to the SortOrder, in plain text.

Declaration
public string BestPlainText { get; }
Property Value
Type Description
String

The best plain text.

Current

Gets or sets the value for the culture specified by CurrentCulture.

Declaration
public string Current { get; set; }
Property Value
Type Description
String

The value for the culture specified by CurrentCulture.

CurrentCulture

Gets or sets the current default culture, which can be accessed with the Current property.

Declaration
public static string CurrentCulture { get; set; }
Property Value
Type Description
String

CurrentLanguageDefaultAudience

Gets or sets the value for the current culture and the default (unnamed) audience.

Declaration
public string CurrentLanguageDefaultAudience { get; set; }
Property Value
Type Description
String

CurrentPlainText

Gets or sets the current plain text.

Declaration
public string CurrentPlainText { get; set; }
Property Value
Type Description
String

The current plain text.

HasMultipleAudiences

Gets a value indicating whether the string has content for multiple audiences.

Declaration
public bool HasMultipleAudiences { get; }
Property Value
Type Description
Boolean

true if the string content for has multiple audiences; otherwise, false.

HasValue

Gets a value indicating whether this instance contains any strings for any cultures.

Declaration
public bool HasValue { get; }
Property Value
Type Description
Boolean

true if this instance has a string for one or more cultures; otherwise, false.

IsEmpty

Gets a value indicating whether this instance contains any strings for any cultures.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
Boolean

true if this instance contains no strings for no cultures; otherwise, false.

Item[String]

Gets or sets the value associated with the specified language.

Declaration
public string this[string key] { get; set; }
Parameters
Type Name Description
String key

The key.

Property Value
Type Description
String

KeysWithValues

Gets the collection of language identifiers with values.

Declaration
public Collection<string> KeysWithValues { get; }
Property Value
Type Description
Collection<String>

KeysWithValuesInAnyAudience

Gets a collection of languages where the default audience has a value or any other audiences have a value for the language.

Declaration
public Collection<string> KeysWithValuesInAnyAudience { get; }
Property Value
Type Description
Collection<String>

PropertyEventsSuspended

Gets a value indicating whether property events are suspended.

Declaration
public bool PropertyEventsSuspended { get; }
Property Value
Type Description
Boolean

true if property events are suspended; otherwise, false.

SupportsFormatting

Gets or sets a value indicating whether the string supports formatting.

Declaration
public bool SupportsFormatting { get; set; }
Property Value
Type Description
Boolean

true if the string supports formatting; otherwise, false.

Methods

AppendTo(String, String)

Appends the specified value to the specified culture.

Declaration
public void AppendTo(string culture, string value)
Parameters
Type Name Description
String culture

The culture.

String value

The value.

AppendTo(String, String, String)

Appends the specified value to the specified culture using the specified separator.

Declaration
public void AppendTo(string culture, string value, string seperator)
Parameters
Type Name Description
String culture

The culture.

String value

The value.

String seperator

The seperator.

Copy(MultilingualString)

Copies the values from the specified source into this instance. Replaces any existing information in this instance.

Declaration
public void Copy(MultilingualString source)
Parameters
Type Name Description
MultilingualString source

The source.

FromString31Serialization(String)

Builds the MultilingualString from a DDI 3.1 XML representation.

Declaration
public void FromString31Serialization(string serialization)
Parameters
Type Name Description
String serialization

The DDI 3 XML serialization.

FromString31Serialization(XElement)

Populates this instance from a DDI 3.1 XML representation.

Declaration
public void FromString31Serialization(XElement root)
Parameters
Type Name Description
XElement root

The root.

GetAudiences()

Gets all audiences for which content is defined.

Declaration
public string[] GetAudiences()
Returns
Type Description
String[]

GetPlainText(String)

Converts the specified string to plain text, removing any HTML formatting.

Declaration
public static string GetPlainText(string str)
Parameters
Type Name Description
String str

The string.

Returns
Type Description
String

GetPlainTextForLanguage(String)

Gets the plain text for the specified language.

Declaration
public string GetPlainTextForLanguage(string lang)
Parameters
Type Name Description
String lang

The language.

Returns
Type Description
String

GetString(String)

Gets the string for the specified culture and the default audience.

Declaration
public string GetString(string culture)
Parameters
Type Name Description
String culture

The culture.

Returns
Type Description
String

GetString(String, String, Boolean)

Gets the string for the specified language and audience.

Declaration
public string GetString(string culture, string audience, bool useFirstAudienceIgnoringAudienceName = false)
Parameters
Type Name Description
String culture

The culture.

String audience

The audience.

Boolean useFirstAudienceIgnoringAudienceName

if set to true [use first audience ignoring audience name].

Returns
Type Description
String

GetStringsForAudience(String)

Gets a dictionary (language -> content) for the specified audience.

Declaration
public Dictionary<string, string> GetStringsForAudience(string audience)
Parameters
Type Name Description
String audience
Returns
Type Description
Dictionary<String, String>

Merge(MultilingualString, Boolean)

Merges the values in the specified source with this instance. If this instance already contains a value for a culture, the values may be joined with NewLine.

Declaration
public void Merge(MultilingualString source, bool append = false)
Parameters
Type Name Description
MultilingualString source

The source.

Boolean append

if set to true append the values; otherwise, only keep the existing value.

OnPropertyChanged(String)

Raises the PropertyChanged event.

Declaration
public void OnPropertyChanged(string propertyName)
Parameters
Type Name Description
String propertyName

Name of the property.

RemoveAudience(String)

Removes the text for the specified audience.

Declaration
public bool RemoveAudience(string audience)
Parameters
Type Name Description
String audience
Returns
Type Description
Boolean

Returns true if text for the audience was removed; otherwise false.

ResumePropertyEvents()

Resumes issuing property events.

Declaration
public void ResumePropertyEvents()

SetString(String, String, String)

Sets the string for the specified language and the specified audience.

Declaration
public void SetString(string culture, string audience, string value)
Parameters
Type Name Description
String culture

The language.

String audience

The audience.

String value

The text.

SetStringForDefaultAudience(String, String)

Sets the string for specified language and the default audience.

Declaration
public void SetStringForDefaultAudience(string culture, string value)
Parameters
Type Name Description
String culture

The culture.

String value

The value.

SuspendPropertyEvents()

Suspends issuing property events.

Declaration
public void SuspendPropertyEvents()

ToString31Serialization()

Returns a string containing a DDI 3 XML representation of the MultilingualString.

Declaration
public string ToString31Serialization()
Returns
Type Description
String

The DDI 3 XML serialization

ToXElement31Serialization()

Converts the string to it's DDI 3.1 XML representation.

Declaration
public XElement ToXElement31Serialization()
Returns
Type Description
XElement

Events

CurrentCultureChanged

Occurs when the current culture is changed.

Declaration
public static event EventHandler CurrentCultureChanged
Event Type
Type Description
EventHandler

PropertyChanged

Occurs when a property value changes.

Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type Description
PropertyChangedEventHandler

Implements

System.Collections.Generic.IDictionary<TKey,TValue>
System.Collections.Generic.ICollection<T>
System.Collections.IDictionary
System.Collections.ICollection
System.Collections.Generic.IReadOnlyDictionary<TKey,TValue>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
System.Runtime.Serialization.ISerializable
System.Runtime.Serialization.IDeserializationCallback
System.ComponentModel.INotifyPropertyChanged

Extension Methods

Extensions.Yield<T>(T)
Extensions.ToJson(MultilingualString)
Extensions.FromJson(MultilingualString, String)
Extensions.GetBestCulture(MultilingualString, List<String>)
Extensions.GetBestString(MultilingualString, List<String>, String)
Extensions.Merge<T>(ICollection<T>, IEnumerable<T>)
In This Article
Back to top Generated by DocFX