From 0fa1999091e2e807bab936b7cc0ccd25ded49983 Mon Sep 17 00:00:00 2001 From: robinvandermolen Date: Tue, 8 Oct 2024 15:05:22 +0200 Subject: [PATCH 1/2] :bug: [#4600] Perform reload on language change --- src/openforms/forms/templates/forms/sdk_snippet.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openforms/forms/templates/forms/sdk_snippet.html b/src/openforms/forms/templates/forms/sdk_snippet.html index 16e268d1cb..557cbe97d5 100644 --- a/src/openforms/forms/templates/forms/sdk_snippet.html +++ b/src/openforms/forms/templates/forms/sdk_snippet.html @@ -23,6 +23,7 @@ {% if sdk_sentry_dsn %}sentryDSN,{% endif %} {% if sdk_sentry_env %}sentryEnv,{% endif %} languageSelectorTarget: '#react-portal--language-selection', + onlanguagechange: () => window.location.reload(), } ); form.init(); From 7d3482b5ddd3fb530ba579b87c92f9bf40e9a7bc Mon Sep 17 00:00:00 2001 From: robinvandermolen Date: Tue, 8 Oct 2024 17:04:38 +0200 Subject: [PATCH 2/2] :memo: [#4600] Updated docs --- docs/developers/embedding.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/developers/embedding.rst b/docs/developers/embedding.rst index b0e545cff3..4127c0e547 100644 --- a/docs/developers/embedding.rst +++ b/docs/developers/embedding.rst @@ -100,6 +100,14 @@ Available options the ``lang`` attribute of the ``html`` element in the DOM - if this is not set, the default value of ``'nl'`` is used. +``onLanguageChange``: + Optional function to call on language changes. By default, the SDK reloads the + content and changes the active language of the form. When using ``onLanguageChange``, + your function will be executed on language change, instead of the default logic. + + The new active language will be passed as an argument to the ``onLanguageChange`` + function as a two-letter identifier. + ``sentryDSN``: Optional `Sentry DSN `_ to monitor the SDK. @@ -129,7 +137,7 @@ Minimal example - + @@ -161,7 +169,7 @@ Full example - +