Table of Contents

Class LocalizableString

Namespace
GroupeIsa.Neos.Shared.Localization
Assembly
GroupeIsa.Neos.Shared.dll

Represents a localizable string.

public sealed class LocalizableString : ReadOnlyDictionary<string, string>, IDictionary<string, string>, ICollection<KeyValuePair<string, string>>, IReadOnlyDictionary<string, string>, IReadOnlyCollection<KeyValuePair<string, string>>, IEnumerable<KeyValuePair<string, string>>, IDictionary, ICollection, IEnumerable, IEquatable<LocalizableString>
Inheritance
LocalizableString
Implements
Inherited Members
Extension Methods

Constructors

LocalizableString()

Initializes a new instance of the LocalizableString class.

public LocalizableString()

LocalizableString(IDictionary<string, string>)

Initializes a new instance of the LocalizableString class from the specified dictionary.

public LocalizableString(IDictionary<string, string> dictionary)

Parameters

dictionary IDictionary<string, string>

The dictionary that contains the data to copy.

LocalizableString(string)

Initializes a new instance of the LocalizableString class from a single localized string.

public LocalizableString(string defaultTranslation)

Parameters

defaultTranslation string

Default localized string.

Properties

DefaultTranslation

Gets the default translation.

public string DefaultTranslation { get; }

Property Value

string

ExtendedProperties

Gets the extended properties used with OData query.

public IDictionary<string, object> ExtendedProperties { get; }

Property Value

IDictionary<string, object>

this[string]

Gets the translation for the specified language.

public string this[string key] { get; }

Parameters

key string

The language id.

Property Value

string

The translation.

Exceptions

KeyNotFoundException

The language id does not exist.

Methods

Combine(LocalizableString, Func<string, string, string>)

Combines a localization string with another localizable string.

public LocalizableString Combine(LocalizableString value, Func<string, string, string> combineMethod)

Parameters

value LocalizableString

Localizable string..

combineMethod Func<string, string, string>

Combine method.

Returns

LocalizableString

The new localizable string.

ContainsKey(string)

Gets a value indicating whether the specified language is defined.

public bool ContainsKey(string key)

Parameters

key string

The language.

Returns

bool

True when the specified language is defined, False otherwise.

ConvertFromJson(string)

Converts from JSON.

public static LocalizableString ConvertFromJson(string value)

Parameters

value string

Value.

Returns

LocalizableString

A new instance of the LocalizableString class.

ConvertFromString(string)

Converts from string.

public static LocalizableString ConvertFromString(string value)

Parameters

value string

Value.

Returns

LocalizableString

A new instance of the LocalizableString class.

ConvertToJson()

Converts to JSON.

public string ConvertToJson()

Returns

string

string representation.

ConvertToString()

Converts to string.

public string ConvertToString()

Returns

string

string representation.

Equals(LocalizableString?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(LocalizableString? other)

Parameters

other LocalizableString

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

FromString(string)

Converts a string to LocalizableString.

public static LocalizableString FromString(string defaultTranslation)

Parameters

defaultTranslation string

Default localized string.

Returns

LocalizableString

The localizable string containing the default translation.

GetAdditionalTranslations(ILocalizationSettings?)

Gets the list of translations except the default one.

public IEnumerable<KeyValuePair<string, string>> GetAdditionalTranslations(ILocalizationSettings? settings = null)

Parameters

settings ILocalizationSettings

Settings.

Returns

IEnumerable<KeyValuePair<string, string>>

The additional translations.

GetDefaultTranslation(ILocalizationSettings?)

Gets default translation.

public string GetDefaultTranslation(ILocalizationSettings? settings = null)

Parameters

settings ILocalizationSettings

Settings.

Returns

string

The default translation.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

ToString(char, char)

Join strings with a delimiter and escape any occurence of the delimiter and the escape character in the string.

public string ToString(char delimiterChar, char escapeChar = '\\')

Parameters

delimiterChar char

Delimiter.

escapeChar char

Escape character.

Returns

string

Joined string.

WithTranslation(string, string?)

Gets a new instance with a modified translation.

public LocalizableString WithTranslation(string language, string? value)

Parameters

language string

Language.

value string

Translation.

Returns

LocalizableString

A new instance.

Operators

implicit operator LocalizableString(Dictionary<string, string>)

Defines an implicit conversion of a given ReadOnlyArray to a array.

public static implicit operator LocalizableString(Dictionary<string, string> dictionary)

Parameters

dictionary Dictionary<string, string>

A array to implicitly convert.

Returns

LocalizableString

implicit operator LocalizableString(string)

Implicitly converts a string to LocalizableString.

public static implicit operator LocalizableString(string defaultTranslation)

Parameters

defaultTranslation string

Default localized string.

Returns

LocalizableString