Skip to main content

MultiLanguage Methods

An object defining methods for the MultiLanguage class.

GetWord(words)

Merges a given dictionary of culture-word pairs into the existing collection. Updates existing words or adds new ones if the culture key is valid.

Parameters:

words (required): string
The dictionary to merge.

Returns:

Type: void
Method does not return anything

This is a sync method. Method runs synchronously.


AddWord(culture, word)

Adds a word for a specific culture if it does not already exist.

Parameters:

culture (required): string
The culture code. e.g. en-US, tr-TR.

word (required): string
The word to add.

Returns:

Type: bool
Returns true if the word is added successfully; otherwise, false.

This is a sync method. Method runs synchronously.


AsDictionary()

Returns a copy of the internal dictionary of culture-word pairs.

Returns:

Type: Dictionary<string, string>
A copy of the internal dictionary of culture-word pairs.

This is a sync method. Method runs synchronously.


ContainsKey(value, stringComparison)

Checks if the dictionary contains a value that matches the given value.

Parameters:

value (required): string
The culture code. e.g. en-US, tr-TR.

stringComparison (required): StringComparison
The comparison type. e.g. OrdinalIgnoreCase, Ordinal.

Returns:

Type: bool
Returns true if the key exists, otherwise false.

This is a sync method. Method runs synchronously.


Clone()

Creates a deep copy of the MultiLanguage instance.

Returns:

Type: MultiLanguage
A new instance with copied values.

This is a sync method. Method runs synchronously.


ContainsValue(value, stringComparison)

Checks if the dictionary contains a value that matches the given value.

Parameters:

value (required): string
The value to check.

stringComparison (required): StringComparison
The comparison type. e.g. OrdinalIgnoreCase, Ordinal.

Returns:

Type: bool
Returns true if the value exists, otherwise false.

This is a sync method. Method runs synchronously.


RemoveWord(culture)

Removes the word associated with a given culture.

Parameters:

culture (required): string
The culture code to remove. e.g. en-US, tr-TR.

Returns:

Type: bool
Returns true if the word is added successfully; otherwise, false.

This is a sync method. Method runs synchronously.


GetWord(culture, defaultCulture, defaultValue)

Adds a word for a specific culture if it does not already exist.

Parameters:

culture (required): string
The culture code. e.g. en-US, tr-TR.

defaultCulture (optional): string
The fallback culture if the requested culture is not found. e.g. en-US, tr-TR.

defaultValue (optional): string
The fallback value if no matching culture is found.

Returns:

Type: string
Returns word for the given culture. If the word is not found, it returns the default value.

This is a sync method. Method runs synchronously.