Skip to main content
Bablic events
Gabriele Manasse avatar
Written by Gabriele Manasse
Updated over 7 years ago

Here is a list of all events fired by Bablic in a translated web page.

You can register to those events using Bablic's Javascript API or using native Document Events.
โ€‹

load

Bablic Library code is loaded to window

document.addEventListener('bablicload',function() { bablic.languages.hide('it'); });

done

Web page was successfully localized on initial page load

bablic.on("done",function(){ console.log('done'); });

translated

Web page was successfully localized, on page load or after language is switched

bablic.on("translated",function(){ console.log('page translated'); });

error

Error in web page localization

bablic.on("error",function(err){ console.error(err); });

locale

Language was determined (or after changed by user)

bablic.on("locale",function(){ console.log(bablic.getLocale()); });

beforeLocaleChange

Before language is changed. Return false to prevent the language change

bablic.on("beforeLocaleChange",function(){ if(DontAllowChange) return false; });

afterWidgetRender

Widget was rendered.

bablic.on("afterWidgetRender",function(element){ element.style.opacity=0.4; });

beforeProcess

Bablic is about to process a root element. Return false to prevent the processing.

bablic.on("beforeProcess",function(rootElement){// do something with element});
Did this answer your question?