Skip to content

Commit

Permalink
Fix: reset location info on changing language (fixes #566)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-steele authored Jul 29, 2024
1 parent 4f04cc8 commit 2a1e7d4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Router extends Backbone.Router {
this.$html = $('html');
this.listenToOnce(Adapt, 'app:dataReady', this.setDocumentTitle);
this.listenTo(Adapt, 'router:navigateTo', this.navigateToArguments);
this.listenToOnce(Adapt, 'configModel:dataLoaded', this.onConfigLoaded);
}

get rootModel() {
Expand Down Expand Up @@ -574,6 +575,14 @@ class Router extends Backbone.Router {
return this.model.set(...args);
}

onConfigLoaded() {
this.listenTo(Adapt.config, 'change:_activeLanguage', this.onLanguageChange);
}

onLanguageChange() {
this.updateLocation(null, null, null, null)
}

}

const router = new Router({
Expand Down

0 comments on commit 2a1e7d4

Please sign in to comment.