Fides Documentation – Ethyca
Interface: FidesLocaleEvent
FidesJS dispatches a FidesLocaleUpdated event when the user changes the language using the language selector in the UI. This event is separate from the consent-focused FidesEvent types and has a simple structure containing only the newly selected locale.
This event extends the standard CustomEvent (opens in a new tab) interface and includes a detail object with the locale and timestamp.
Example Permalink for this section
window.addEventListener("FidesLocaleUpdated", (evt) => {
console.log(`Language changed to: ${evt.detail.locale}`);
});
For more information on working with these kind of CustomEvent objects in the browser, see the MDN docs:
https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent (opens in a new tab)
Event Type Permalink for this section
FidesLocaleUpdated: Dispatched when the user changes the language using the language selector in the FidesJS UI. This event fires after the locale has been successfully changed and applied to the UI.
Note: This event is intentionally separate from consent-related FidesEvent types. It does not include consent data or the complex extraDetails structure. It will not be forwarded to GTM or other consent-focused integrations.
Extends Permalink for this section
CustomEvent
Properties Permalink for this section
detail Permalink for this section
detail:
object
Event properties passed when the locale is updated.
locale Permalink for this section
locale:
string
The newly selected locale (e.g., "en", "fr", "es", "de") which will match the Fides.locale value. See Fides.locale for detail.
timestamp? Permalink for this section
optionaltimestamp:number
High-precision timestamp from performance.mark() (opens in a new tab) representing when this event was created. The timestamp is measured in milliseconds since page load.
May be undefined if the Performance API is not available.
Example Permalink for this section
window.addEventListener("FidesLocaleUpdated", (evt) => {
console.log(`Locale: ${evt.detail.locale}`);
console.log(`Timestamp: ${evt.detail.timestamp}ms`);
});
Overrides Permalink for this section
CustomEvent.detail
[FidesExperienceConfig](/content/docs/privacy-center-fidesjs/fidesjs/reference/interfaces/FidesExperienceConfig "FidesExperienceConfig"/index.html) [PrivacyNoticeRegion](/content/docs/privacy-center-fidesjs/fidesjs/reference/enumerations/PrivacyNoticeRegion "PrivacyNoticeRegion"/index.html)