-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: add support for --exclude-routes *
#125
Comments
Hi @bl9l, can you please explain that a little further? I'm not familiar with the way @gilsdav/ngx-translate-router works. I had a look a the README and now I wonder if angular-prerender would be able to detect any of the translated routes at all. I guess the guess-parser (no pun intended :-)) can't detect the translations and will only pick up the default language. But maybe I'm wrong. |
It works like so: For example I have this routes configuration [{
path: 'some-page',
component: SomeComponent,
}] And my app supports two langs Now I need to localize the URL of the page with <a [routerLink]="['/some-page'] | localize">SomePage Link</a> It generates different Speaking of how this lib replaces the original URLs with localized ones - i don't know :) |
Thanks for the clarification. Just to be sure I understood this correctly. You want angular-prerender to render Could you please set up a little example project based on your example? I think that would make it far easier to add this feature and we could also use it as basis for adding an integration test to the test suite. |
Hello again. Sorry for 10 days delay. |
Thanks a lot for providing the example project. That was really helpful. I'm afraid there is no way to detect the localization of the routes which happens in the templates. angular-prerender uses the In case of your example these routes will be: /some-page
/another-page What do you think about adding an option to angular-prerender to specifiy the JSON file with the translations? npx angular-prerender --ngx-translate-router-config src/assets/en.json The result would then be that angular-prerender renders the english routes: /some-page-localized
/another-page-localized Would something like that work for you? Do you know if there is a way to programmatically use the translation logic of ngx-translate-router or would we need to reimplement that? |
That's unfortunate. I didn't think about how Angular stores its routes tree and in order to parse it we need to parse ts files instead of the compiled url tree. Damn lazy modules :D. Anyway. In order to work around npx angular-prerender --ngx-translate-router-config ./ngx-translate-router-config.json
{
"prefix": "ROUTES",
"files": [
"src/assets/en.json",
"src/assets/ru.json",
"src/assets/fr.json"
]
} What do you think? |
Ah you mean instead of running angular-prerender for each language it should better render all languages at once? One thing that will not work though is any extra configuration as described here: https://github.com/gilsdav/ngx-translate-router#excluding-routes The guess-parser doesn't extract the |
If the |
Hi @bl9l, sorry for the long delay. I just submitted a PR to your test-case which implements a route process plugin. These are plugins used by Scully to pre-process the routes before the rendering starts. I added support for them today. I'm trying to enable Scully plugins for angular-prerender anyway and thought they come in handy here as well. What do you think? |
Hi.
I'm using @gilsdav/ngx-translate-router.
So I have to manualy exclude each route by adding it to
--exclude-routes
.Is it possible to either add the support of wildcard exclude or the propper parsing that can handle localized routes?
The text was updated successfully, but these errors were encountered: