sivaprasad9394
Occasional Collector

How to create sections in different languages in ContentCreator?

Hello Team,

Does some one has some more information on the topic translations?

Also any links or documentation would be helpful regarding the implementation.

Thank you.

Regards,

Siva

0 Kudos
8 Replies
hoebbel
Crownpeak employee

Dear Siva,

maybe one of the following links will help you to solve the issue

FirstSpirit Online Documentation - Translation Help

ContentCreator – for editors - Translation help

Both show more or less the same thing. The first how to implement a translation help, the second how to then use it.

Best regards,

Holger

0 Kudos

Dear Holger,

Thank you for your reply and time.

Regarding adding the translation help in the content creator menu of each sections,

How to get the element here? Do we need Executable interface here?

How that specific menu will be added directly in the content-creator menu?

How to write code for content-creator?

public class TranslationInlineSection implements Executable {

    private static Class<TranslationInlineSection> LOGGER = TranslationInlineSection.class;

    private BaseContext baseContext = null;

    private Language currentLanguage = null;

    private LanguageAgent languageAgent = null;

    private PageRef currentPageRef = null;

    private Map<String, Language> projectLanguages = null;

    // Assuming we have a BaseContext object named 'context' and

    // a store element object of type DataProvider named 'element' available...

   

   

    public TranslationInlineSection() {

        super();

    }

   

   

    public void translationInlineSection(BaseContext context) {

        baseContext = context;

        if (baseContext.is(BaseContext.Env.WEBEDIT)) {

            WebeditUiAgent webeditUiAgent = baseContext.requireSpecialist(WebeditUiAgent.TYPE);

            currentLanguage = webeditUiAgent.getPreviewLanguage();

            // Obtain a LanguageAgent to get a map of project languages.

            languageAgent = context.requireSpecialist(LanguageAgent.TYPE);

            projectLanguages = languageAgent.getProjectLanguages(false);

            if(webeditUiAgent.getPreviewElement() instanceof PageRef) {

                currentPageRef = (PageRef) webeditUiAgent.getPreviewElement();

               

            }

            translationOperation(baseContext);

        }

    }

    private void translationOperation(BaseContext context) {

        final OperationAgent operationAgent = context.requireSpecialist(OperationAgent.TYPE);

        final TranslationOperation translationOperation = operationAgent.getOperation(TranslationOperation.TYPE);

        if (translationOperation != null) {

            translationOperation.setElement(element);

            translationOperation.setSourceLanguage(element.getProject().getMasterLanguage());

            translationOperation.setTargetLanguage(currentLanguage);

            // According to the above configuration: open a translation help dialog for the

            // element

            // indicated by 'element', and translate from English to Welsh.

            translationOperation.perform();

        }

    }

    @Override

    public Object execute(Map<String, Object> params, Writer out, Writer err) throws ExecutionException {

        final BaseContext context = (BaseContext) params.get("context");

        translationOperation(context);

        return true;

    }

Thank you,

Siva

0 Kudos

Hi Siva,

you need a WebeditInlineEditItemsPlugin here to add a button to the sections. You can find an example implementation here: FirstSpirit Online Documentation - Examples

... in the "ContentCreator Examples Source Code Package":

406965_pastedImage_1.png

The translation example is located in the class

de.espirit.firstspirit.opt.example.webedit.translationhelp.StartTranslationInlineEditItemsPlugin

It also contains some logic to check for an existing Translation Plugin (which would be the "non UI part" only responsible for performing the translation itself) - if you don't plan to use one, you can just remove those parts and just trigger the TranslationOperation.

Best,

Michael

0 Kudos

Hi Bergmann,

Thank you for your reply and time.

Information you have shared is helpful for me to know more things.

As of now i have installed the fs5_webclient_examples.fsm module in our system.

Also commented out all public components except StartTranslationInlineEditItemsPlugin from module.xml .

Built the module(5.2.200508), installed it in Modules (server manager).

After restarted all the service in server manager.

But translation help button is not displayed in the content creator sections. (Image attached below)

Am i missing something here?

web_edit_server_manager_modules.png

content_creator_d.png

Thanks and Regards,

Siva

0 Kudos

Hi Siva,

have you also installed the module’s WebApp component ("WebClient examples: run-time library for WebClient5") in the global or project local ContentCreator WebApp?

Regards,

Michael

0 Kudos

Hi Bergmann,

Thank you for your reply.

If i am not wrong you are asking about the fs-webedit-plugins.fsm module. Its Global.

Attached screenshot for reference,

modules_configuration.png

Thank you,

Siva

0 Kudos

Dear Siva,

you have to add the web-component of the module to the ContentCreator web application, where the translation should be used.

This ContentCreator web application is either a project local or the global ContentCreator web application, which is used, if no project local web application is defined.

Here's a screenshot, where you have to add the web-component of the module, if the global ContentCreator web application is used:

411314_pastedImage_0.png

You'll find the project local web applications in the project properties -> Web components. If there is no active web server defined (), than the global ContentCreator web application is used.

Best regards,

Holger

0 Kudos
hoebbel
Crownpeak employee

Dear Siva,

and don't forget to update the ContentCreator web application after you added the web-component of the module.

411316_pastedImage_0.png

Attention: This will shutdown all active session within the appropriate ContentCreator web application! It will take approximate 1 minute to update the web application. You get a popup message afterwards within the ServerManager, when the update of the web application is finished.

Best regards,

Holger

0 Kudos