November Happy Hour will be moved to Thursday December 5th.

EpiForms - multi-step forms: Translate the text in the "Previous step" and "Next step" buttons

Vote:
 

Is it possible to translate the text in the previous / next step buttons on a multi page epi form? I am new to Epi Forms so please forgive me if there is an obvious answer to this ;).

#272725
Feb 22, 2022 11:38
Vote:
 

Hi Mat,

You can do it via the localization (https://world.optimizely.com/documentation/developer-guides/CMS/globalization/localizing-the-user-interface/). Just create a new XML with the following structure and replace the labels as required:

<?xml version="1.0" encoding="utf-8"?>
<languages>
    <language name="English" id="en">
        <episerver>
            <forms>
                <viewmode>
                    <stepnavigation>
                        <previous>Previous step</previous>
                        <next>Next step</next>
                    </stepnavigation>
                </viewmode>
            </forms>
        </episerver>
    </language>
</languages>
#274683
Feb 28, 2022 11:07
Mat Hope - Feb 28, 2022 11:32
Hi Jake,

Thanks for your detailed response, greatly appreciated. How does the translation work using these files and does it matter if they are created before or after the content is created in the CMS? Is there a process that needs to be run to pickup the entries in these files or are they retrieved in real time?

Sorry for these naïve questions; I am new to this...

Cheers
Mat
Vote:
 

Hi again,

So, I think the documentation is pretty good on localization, but as a summary:

  1. By default, UI localization is handled by XML files in Optimizely CMS.
  2. The default path for these XMLs is a folder called "lang" under the content root.
  3. You create XMLs with a specified structure allowing you to override existing strings.

An example is in Foundation: https://github.com/episerver/Foundation/tree/main/src/Foundation/lang

In short, you create the "lang" folder in your solution (if it doesn't exist already), create an XML (maybe call it Forms_EN.xml) and copy the snippet into it that I provided above. This will be (by default) picked up automatically from that location, if doesn't matter if content has already been created.

To find the XPath of an existing string so you can override it your best bet is to use a decompiler (like JustDecompile) and dig around in the assembly. Here is an old blog post (from CMS 7) that gives an idea of the structure and approach, whilst this is old the technique still holds up: https://getadigital.com/no/blogg/translating-episerver-ui/

Finally, it's actually possible to change the localization provider, if you want to make this stuff more accessible to editors I recommend the DbLocalizationProvider which is available as a NuGet package (https://github.com/valdisiljuconoks/localization-provider-epi).

Hope that's enough detail to get you started.

#274687
Edited, Feb 28, 2022 15:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.