I have a plugin that defines a custom input type that effectively creates a tags input type with an enum of valid values that come from a reference to another content model. This content and enums need to be localizeable so I need for the plugin to know what locale of the content is being viewed but it is unclear how I access this context. Can you provide documentation for how a custom input type plugin could get context as to the current locale of the content that is being edited?
Hello @jhs129,
To access the current locale of the content being edited in a custom input type plugin within Builder.io, you can pass the locale
as a prop to the <BuilderComponent>
. This ensures localized inputs are automatically resolved based on the user’s locale.
It seems, you could possibly access current editing locale from appState
appState.designerState.locale
You can refer to the below plugin example, which could possibly help as well
Let us know how that works for you!
Best regards,
Hello @jhs129,
Just following up to see if using appState.designerState.locale
helped resolve the issue you were encountering.
If you’re still facing challenges or have any questions, please don’t hesitate to reach out — we’re happy to help!
Thanks again,
Thanks Manish! This did work!
Regards,
John
m: 404.307.5530
e: john.schneider@jhsconsulting.net
Book a Meeting