Skip to the content

Calendar & script localization

Any script variable , page part, and calendar can be translated during culture change event thanks to OnJSLocalization custom function. This function will be called only if it is created inside the hosting page.

 

NOTICE: OnJSLocalization function will be called only if it is created inside the hosting page.

NOTICE: The calendar can be designed by calendar.css. If reference fo these styles isn't present inside head tags of the hosting page than It will be referenced during run time (for this purpose file must be located with eForm scripts as it is inside NuGet repository).

NOTICE: Culture codes are created inside the Designer with localization creation.

Example:

const OnJSLocalization = function (e) {
    //TODO: do some stuff here (change web labels/design etc.)
    //localization logic
    switch (e) {
        case 'en-US':
            //calendar localization for US english
            months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
            shortDays = ["Mon“, "Tue", "Wed“, "Thu", "Fri", "Sat", "Sun"];
            longDays = ['Monday', 'Tuestaday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];

            someVariableFromPage = 'translation';

            break;
        case 'cs-CZ':
            //calendar localization for Czech
            months = ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'];
            shortDays = ["Po", "Ut", "St", "Čt", "Pá", "So", "Ne"];
            longDays = ['Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota', 'Neděle'];

           someVariableFromPage = 'překlad';

            break;
    }
}