Translation Service
Various use cases require the translation of text or documents. For example, the Axon Ivy Portal offers a service that enables easy translation of text fields to make it multilingual. The CMS Editor will also be enriched with a feature to translate Content Objects quickly. And of course, any project could require translation support.
That's why we are building a native translation service powered by DeepL into the Axon Ivy Engine. Simply configure it in the ivy.yaml to make use of it. The translation service features a simple yet powerful API to accomplish your translation needs. In case you want to use another service as a translation provider, you can implement the available Service Provider Interface (SPI) to do so.
Audience
- Low-coders
- Process developers
- Team WaWa (Axon Ivy Portal)
Value
- Native translation service by the Axon Ivy Engine
- Paving the way for a CMS Editor with translation capabilities
Version
Next steps
- Support more parameters
- Make API/SPI public
Screenshots / Code
Translate text:
TranslationService service = TranslationService.find("DeepL").get();
String translation = service.translate("Hello, World!")
.from(Locale.ENGLISH)
.to(Locale.GERMAN);
System.out.println(translation); // "Hallo, Welt!"
Translate document:
Path document = Path.of("home", "spy", "secret-plan.pdf");
String fileName = document.getFileName().toString();
TranslationService service = TranslationService.find("DeepL").get();
try (InputStream fileStream = Files.newInputStream(document);
InputStream translation = service.translate(fileName, fileStream)
.from(Locale.ENGLISH)
.to(Locale.GERMAN)) {
System.out.println(new String(translation.readAllBytes())); // "Mein geheimer Plan. Psst!"
} catch (IOException ex) {
throw new RuntimeException(ex);
}