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
Expected Behavior
Display the translations when the language is changed through the
@ngx-translateservice.Current Behavior
I tried using the
setLanguagemethod, but I believe oncerunis called, theconfigwon't get updated. Hence,setLanguageisn'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