MetaPhrase

An open source translation editor for native mobile app localization.

View project on GitHub

//MetaPhrase/com.github.diegoberaldin.metaphrase.domain.mt.repository.datasource/MachineTranslationDataSource

MachineTranslationDataSource

[jvm]
interface MachineTranslationDataSource

Contract for any machine translation connector with a remote provider. This interface is just for documentation, since concrete implementations are injected in com.github.diegoberaldin.metaphrase.domain.mt.repository.DefaultMachineTranslationRepository.

Functions

Name Summary
contributeTranslation [jvm]
abstract suspend fun contributeTranslation(sourceMessage: String, sourceLang: String, targetMessage: String, targetLang: String, key: String? = null)
Share a translation to the remote provider.
generateKey [jvm]
abstract suspend fun generateKey(username: String, password: String): String
Generate an API key. This may not be supported by all providers. It is up to the implementation whether to return an empty string or throw an exception if the operation is not supported.
getTranslation [jvm]
abstract suspend fun getTranslation(sourceMessage: String, sourceLang: String, targetLang: String, key: String? = null): String
Get a suggestion (translation) from the remote provider.
import [jvm]
abstract suspend fun import(file: File, key: String? = null, private: Boolean = false, name: String? = null, subject: String? = null)
Import a TMX file to the remote provider.