-
-
Notifications
You must be signed in to change notification settings - Fork 458
Description
Expected Behavior
Display the translations when the language is changed through the @ngx-translate
service.
Current Behavior
I tried using the setLanguage
method, but I believe once run
is called, the config
won't get updated. Hence, setLanguage
isn't working?
Steps to reproduce
Currently, I have like this
ngOnInit(): void {
this.translationService.onLangChange.subscribe((event) => {
// event.translations?.['cookie'] would contain the translations for different languages.
const cookie =(event.translations?.['cookie'] as CookieTranslations) ?? null;
if (cookie) {
CookieConsent.run({
guiOptions: this.guiOptions,
categories: this.categories,
language: {
default: event.language,
translations: {
[event.language] = {
consentModal: {
title: cookie.title,
description: cookie.description,
// and so on
} // The rest of the properties using cookie constant
}
})
}
At this point, how do I ensure that the translations are reflected accordingly when a language is changed?
Proposed fix or additional info.
No response
Version
3.1.0
On which browser do you see the issue?
Chrome, Firefox, Safari, Microsoft Edge