Zum Hauptinhalt gehen

How to create sections in different languages in ContentCreator?

Kommentare

7 Kommentare

  • Zendesk API User
    Author: hoebbel - 2/12/2021 13:38

    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
  • Zendesk API User
    Author: sivaprasad9394 - 2/16/2021 7:55

    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
  • Zendesk API User
    Author: mbergmann - 2/24/2021 8:43

    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":

    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
  • Zendesk API User
    Author: sivaprasad9394 - 3/12/2021 1:45

    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?

    Thanks and Regards,

    Siva

    0
  • Zendesk API User
    Author: mbergmann - 3/12/2021 6:46

    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
  • Zendesk API User
    Author: sivaprasad9394 - 3/12/2021 7:03

    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,

    Thank you,

    Siva

    0
  • Zendesk API User
    Author: hoebbel - 3/12/2021 7:35

    Dear Siva,

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

    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

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.