Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.huymluu:yandex-translate-api:'
}
dependencies {
implementation("com.github.huymluu:yandex-translate-api:")
}
<dependency>
<groupId>com.github.huymluu</groupId>
<artifactId>yandex-translate-api</artifactId>
<version></version>
</dependency>
libraryDependencies += "com.github.huymluu" % "yandex-translate-api" % ""
:dependencies [[com.github.huymluu/yandex-translate-api ""]]
Get free API key at https://tech.yandex.com/translate/
YandexTranslator yandexTranslator = new YandexTranslator("YOUR YANDEX API KEY");
List<Language> supportedLanguages = yandexTranslator.getSupportedLanguages();
// Translate single term - explicit 'from' & 'to' languages
String translated = yandexTranslator.translate("Hello world", Language.ENGLISH, Language.GERMAN);
// Translate single term - auto detect 'from' language
String translated = yandexTranslator.translate("Hello world", Language.GERMAN);
// Translate list of terms
List<String> input = new ArrayList<String>();
input.add("Hello");
input.add("World");
List<String> translated = yandexTranslator.translate(input, Language.GERMAN);
// Auto detect best language
Language detectedLanguage = yandexTranslator.detectLanguage("Hello world");
// Detect best language with hint
Language detectedLanguage = yandexTranslator.detectLanguage("Hallo", Language.GERMAN);
// Detect best language with multiple hint
Language detectedLanguage = yandexTranslator.detectLanguage("Hallo", Language.ENGLISH, Language.GERMAN);
Get free API key at https://tech.yandex.com/dictionary/
YandexDictionary yandexDictionary = new YandexDictionary("YOUR YANDEX API KEY");
Map<Language, List<Language>> directions = yandexDictionary.getSupportedTranslateDirections();
// Simple lookup
List<Definition> definitions = yandexDictionary.lookup("time", Language.ENGLISH, Language.GERMAN);
// Lookup with flags (not sure what it means, read https://tech.yandex.com/dictionary/doc/dg/reference/lookup-docpage/)
List<Definition> definitions = yandexDictionary.lookup("time", Language.ENGLISH, Language.GERMAN, LookupFlag.FAMILY, LookupFlag.MORPHO, LookupFlag.POS_FILTER);
options
, ui