registerSource

fun registerSource(languageCode: String, translationSource: TranslationSource)

Registers a translation source for a language code.

This method takes a string and a TranslationSource object as parameters and adds them as a key-value pair to the sources map. The string should be a valid language code, such as "en", "fr", "zh", etc. The TranslationSource object should be an instance of a class that implements the TranslationSource interface and provides methods for translating texts from one language to another. The method throws an IllegalStateException if the language code is already registered in the map. The method does not return anything.

Parameters

languageCode

a string representing the language code to register.

translationSource

a TranslationSource object representing the translation source to register.

Throws

if the language code is already registered in the map.