jump to top

Startseite / Plugin-Entwicklung / ContentCreator-Erweiterungen / Interaktive Features / Übersetzungshilfe

Translation Help

ContentCreator offers a translation help feature which allows side-by-side translation and automated translation by way of accessing external translation services.

Due to varying project-specific and/or business requirements, this translation help is not integrated into the ContentCreator user interface out-of-the-box, but instead can be integrated by project and module developers using scripts and Java plug-ins. This allows developers to implement functionality required before and after use of the translation help dialog, and this functionality can be tailored to the project's and/or organization's specific needs.

For example, organizations may not want every single FirstSpirit element visible in a ContentCreator preview to be translated, or they may want to enable only certain user groups to use translation functionality. Furthermore, developers are free to implement functionality for selecting source and target languages before translation and handling the preview afterwards (e.g. remaining in the original preview to allow an editor to translate another element or navigating to the same page in the target language so that the editor may see the content he translated) that meets business requirements.

The translation help feature may be integrated exactly where it is needed in a project, e.g. via an InlineEdit button, an FS_BUTTON shown in the preview, or a data access plug-in's report.

Opening a Translation Help Dialog

FirstSpirit Developer API Interface: de.espirit.firstspirit.webedit.server.TranslationOperation
Developer API Documentation: TranslationOperation

Translation help may be started using the operation TranslationOperation, which may be accessed using the OperationAgent (see Using FirstSpirit APIs > Accessing FirstSpirit Functionality).

// Assuming we have a BaseContext object named 'context' and
// a store element object of type DataProvider named 'element' available...

// Obtain a LanguageAgent to get a map of project languages.
final LanguageAgent languageAgent = context.requireSpecialist(LanguageAgent.TYPE);
final Map<String, Language> projectLanguages = languageAgent.getProjectLanguages(false);

final OperationAgent operationAgent = context.requireSpecialist(OperationAgent.TYPE);
final TranslationOperation translationOperation = operationAgent.getOperation(TranslationOperation.TYPE);
if (translationOperation != null) {

// According to the above configuration: open a translation help dialog for the element
// indicated by 'element', and translate from English to Welsh.

Using a Translation Plug-In

FirstSpirit Developer API Interface: de.espirit.firstspirit.webedit.plugin.translation.TranslationPlugin
Developer API Documentation: TranslationPlugin

Using a translation plug-in, the TranslationOperation can be configured to connect to an external translation service in order to provide automatic or on-demand translation.

The plug-in may register a translator object for either of two translation types, which are defined as constants in the interface TranslationType:

  • TEXT
    Translates simple text.
  • XML
    Uses XML (e.g. in order to transport unique identifying attributes so that translated text structures can be matched to the source text).

The translator object implements the interface TranslationHost.Translator<T>, where the parameterization T must be String for both translation types, TEXT and XML.

Within a translator implementation, the method String translate(TranslationContext, String) receives a context object of type TranslationContext, through which source and target language as well as the GOM form element are available.

public class MyTranslationPlugin implements TranslationPlugin {

public void register(@NotNull final TranslationHost host) {
host.register(TranslationType.TEXT, new MyTextTranslator());

public void setUp(@NotNull final BaseContext context) {

public void tearDown() {

private static class MyTextTranslator implements TranslationHost.Translator<String> {

public String translate(@NotNull final TranslationContext context, @NotNull final String object) {
final Language sourceLanguage = context.getSourceLanguage();
final Language targetLanguage = context.getTargetLanguage();
// Connect to some translation service and use it to translate the String 'object' from
// the source language to the target language. Return the result.

© 2005 - 2020 e-Spirit AG | Alle Rechte vorbehalten. | FirstSpirit 2020-09 | Datenschutz | Impressum | Kontakt