changing language doesn't refresh meta (ng-seed/spa does because it reload the page!)
Closed this issue · 4 comments
I'm submitting a ... (check one with "x")
[x] bug report => check the README and search github for a similar issue or PR before submitting
[ ] support request => check the README and search github for a similar issue or PR before submitting
[ ] feature request
Current behavior
- Put the callback method to use Translate library
callback: (key: string) => translate.get(key),
- Put the
guard
and set data in your route set data property of your route
data: {
meta: {
title: 'DASHBOARD.TITLE'
}
}
- Suppose that you have a button to switch the language, this button execute this code:
this.translate
.use(langToSet)
.subscribe(() => this.meta.setTag('og:locale', langToSet));
When you change the language, the translation on your page will change, but the title of the page will remains the same.
Expected/desired behavior
As the content of your page change when you call this.translate(lang)
, the meta should also change.
Minimal reproduction of the problem with instructions
You can reproduce this issue in the ng-seed/spa project if you remove the reload of the page (triggered by the this.router.navigate(['/'])
or this.i18nRouter.changeLanguage(languageCode);
).
The title will remains the same.
What is the motivation / use case for changing the behavior?
The title of the tab should be in the language selected by the user as the content does.
- Angular version: 4.1.3
"@ngx-meta/core": "0.4.0-rc.2",
"@ngx-translate/core": "7.1.0",
"@ngx-translate/http-loader": "0.1.0"
-
Browser: [ all ]
-
Language: [ TypeScript 2.3.4 ]
-
Node (for AoT issues):
node --version
= 7.10.0
Yeay! I'm thinking of starting helping you, all the libraries ngx-*
are amazing.
@Tuizi really appreciate that you liked and utilized features from those libraries, and the community would be really glad from your contributions.
Meanwhile, more is coming: such as integrating @angular/material2
to ng-seed
, d3.js
and datatables
implementation for material design.
Any updates on the issue?