Skip to content

Commit

Permalink
Merge pull request #97 from virtualidentityag/fix/DIAKONIE-283-langua…
Browse files Browse the repository at this point in the history
…ge-change-after-registration

fix: set preferred language in registration
  • Loading branch information
janrembold authored Apr 24, 2024
2 parents d44fb00 + f09ab26 commit 93a0c12
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/extensions/components/registration/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import {
registrationSessionStorageKey,
RegistrationData,
NotificationsContext,
NOTIFICATION_TYPE_ERROR
NOTIFICATION_TYPE_ERROR,
LocaleContext
} from '../../../globalState';
import { GlobalComponentContext } from '../../../globalState/provider/GlobalComponentContext';
import {
Expand Down Expand Up @@ -83,6 +84,7 @@ export const Registration = () => {
} = useContext(RegistrationContext);
const { consultant: preselectedConsultant } = useContext(UrlParamsContext);
const { tenant } = useContext(TenantContext);
const { locale } = useContext(LocaleContext);

const [stepData, setStepData] = useState<Partial<RegistrationData>>({});
const [redirectOverlayActive, setRedirectOverlayActive] =
Expand Down Expand Up @@ -185,7 +187,7 @@ export const Registration = () => {
agencyId: registrationData.agency.id.toString(),
postcode: registrationData.zipcode,
termsAccepted: 'true',
preferredLanguage: 'de',
preferredLanguage: locale || 'de',
consultingType: registrationData.agency.consultingType,
...(preselectedConsultant
? { consultantId: preselectedConsultant?.consultantId }
Expand Down Expand Up @@ -222,7 +224,8 @@ export const Registration = () => {
settings.multitenancyWithSingleDomainEnabled,
tenant,
addNotification,
t
t,
locale
]);

const stepPaths = useMemo(
Expand Down
4 changes: 3 additions & 1 deletion src/globalState/provider/LocaleProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export function LocaleProvider(props) {
const [initLocale, setInitLocale] = useState(null);
const { informal } = useContext(InformalContext);
const [locales, setLocales] = useState([]);
const [locale, setLocale] = useState(null);
const [locale, setLocale] = useState(
localStorage.getItem(STORAGE_KEY_LOCALE) || null
);

useEffect(() => {
// If using the tenant service we should load first the tenant because we need the
Expand Down

0 comments on commit 93a0c12

Please sign in to comment.