EasyTalk API
Loading...
Searching...
No Matches
EasyTalk.Localization.TranslationLibrary Class Reference

Provides a collection of translations of text for various languages. More...

Inheritance diagram for EasyTalk.Localization.TranslationLibrary:

Public Member Functions

Translation GetTranslation (string line, string targetLanguageCode)
 Returns the translation for the specified line of text and ISO-639 language code, if it exists.
 
int GetTextDefinitionId (string text)
 Returns the ID of the translation entry (in the original/default writing language) which matches the specified text.
 
TranslationSet GetOrCreateOriginalTranslationSet ()
 Retrieves or creates a translation set for the default/original language of the library.
 
bool HasTranslationSet (string languageCode)
 Returns true if the library contains a TranslationSet for the ISO-639 language code provided.
 
TranslationSet AddSecondaryTranslationSet (string languageCode)
 Add a TranslationSet for the ISO-639 language code specified if it doesn't exist in the library.
 
TranslationSet FindTranslationSetForLanguage (string languageCode)
 Finds and returns the TranslationSet for the specified ISO-639 language code.
 
List< TranslationGetUntranslatedLines (string languageCode)
 Returns a List of untranslated Translations (lines) for the specified ISO-639 language code. Any empty entries in the found TranslationSet are assumed to be untranslated.
 
void SetOriginalLanguage (string languageCode)
 Changes the original language of the library to the specified ISO-639 language code and adds a TranslationSet for it if one doesn't exist for that language.
 
Translation AddOrFindTranslation (string text, bool copySourceTextToAll=false)
 Adds a new translation entry based on the text provided for each language in the translation library.
 

Public Attributes

string originalLanguage = "en"
 The original/default language for the translation library.
 
List< TranslationSettranslationSets = new List<TranslationSet>()
 A list of TranslationSets, each containing translations for a specific language.
 

Detailed Description

Provides a collection of translations of text for various languages.

Member Function Documentation

◆ AddOrFindTranslation()

Translation EasyTalk.Localization.TranslationLibrary.AddOrFindTranslation ( string text,
bool copySourceTextToAll = false )

Adds a new translation entry based on the text provided for each language in the translation library.

Parameters
textThe text to use when adding a translation entry for the source/default language.
copySourceTextToAllWhen set to true, all alternate languages will have their translation entry set to the provided text value. By default, this flag is false, and new entries for alternate languages will be left blank.
Returns
The translation entry for the provided string.

◆ AddSecondaryTranslationSet()

TranslationSet EasyTalk.Localization.TranslationLibrary.AddSecondaryTranslationSet ( string languageCode)

Add a TranslationSet for the ISO-639 language code specified if it doesn't exist in the library.

Parameters
languageCodeThe ISO-639 language code to add a TranslationSet for.
Returns
The TranslationSet for the language code specified.

◆ FindTranslationSetForLanguage()

TranslationSet EasyTalk.Localization.TranslationLibrary.FindTranslationSetForLanguage ( string languageCode)

Finds and returns the TranslationSet for the specified ISO-639 language code.

Parameters
languageCodeThe ISO-639 language code to find a TranslationSet for.
Returns
The TranslationSet for the specified language, if it exists; null otherwise.

◆ GetOrCreateOriginalTranslationSet()

TranslationSet EasyTalk.Localization.TranslationLibrary.GetOrCreateOriginalTranslationSet ( )

Retrieves or creates a translation set for the default/original language of the library.

Returns
A TranslationSet for the default/original language of the library.

◆ GetTextDefinitionId()

int EasyTalk.Localization.TranslationLibrary.GetTextDefinitionId ( string text)

Returns the ID of the translation entry (in the original/default writing language) which matches the specified text.

Parameters
textThe text to match (in the source language).
Returns
The ID used for translations of the specified text. If no entry is found matching the text provided, this method returns -1.

◆ GetTranslation()

Translation EasyTalk.Localization.TranslationLibrary.GetTranslation ( string line,
string targetLanguageCode )

Returns the translation for the specified line of text and ISO-639 language code, if it exists.

Parameters
lineThe line to translate.
targetLanguageCodeThe ISO-639 language code to translate to.
Returns
The translated line, if found; otherwise null.

◆ GetUntranslatedLines()

List< Translation > EasyTalk.Localization.TranslationLibrary.GetUntranslatedLines ( string languageCode)

Returns a List of untranslated Translations (lines) for the specified ISO-639 language code. Any empty entries in the found TranslationSet are assumed to be untranslated.

Parameters
languageCodeThe ISO-639 language code of the TranslationSet to get untranslated lines for.
Returns
A List of untranslated lines for the language code specified.

◆ HasTranslationSet()

bool EasyTalk.Localization.TranslationLibrary.HasTranslationSet ( string languageCode)

Returns true if the library contains a TranslationSet for the ISO-639 language code provided.

Parameters
languageCodeThe ISO-639 language code to check for a translation set.
Returns
True if a TranslationSet is found for the specified ISO-639 language code.

◆ SetOriginalLanguage()

void EasyTalk.Localization.TranslationLibrary.SetOriginalLanguage ( string languageCode)

Changes the original language of the library to the specified ISO-639 language code and adds a TranslationSet for it if one doesn't exist for that language.

Parameters
languageCodeThe ISO-639 language code to change to.

Member Data Documentation

◆ originalLanguage

string EasyTalk.Localization.TranslationLibrary.originalLanguage = "en"

The original/default language for the translation library.

◆ translationSets

List<TranslationSet> EasyTalk.Localization.TranslationLibrary.translationSets = new List<TranslationSet>()

A list of TranslationSets, each containing translations for a specific language.