Skip to content
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

Translated route child wildcard routes #104

Open
AntonVandeghinste opened this issue Mar 16, 2021 · 2 comments
Open

Translated route child wildcard routes #104

AntonVandeghinste opened this issue Mar 16, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@AntonVandeghinste
Copy link

Hello

This is more of a question than it is an issue.
Regarding wildcard routes, I have seen issue #36.
I also see the mention about it in the README.

However, in some cases we would want a child route to be a wildcard (within a certain component for example).
Stated the fact it is impossible to know from a wildcard route, if the language is present or not, when a child wildcard route is on a translated parent, wouldn't you know for a fact the language is present?

Simplified example:

const routes: Routes = [
  { path: 'BankAccount/:accountNumber', component: BankAccountComponent,
    children: [
      { path: '', component: OverviewComponent},
      { path: 'STATEMENTS', children: [
        { path: '', component: StatementsOverviewComponent},
        { path: 'SEARCH_STATEMENTS', component: SearchStatementsComponent },
        { path: '**', component: QuarterlyViewStatementsComponent }
      ]},
  ]},
];

(NOT a real example)
Say on OverviewComponent, you have N quarters lined to choose from with `[routerLink]="['BankAccount', myAccountNumber, 'Statements', 'QxYYYY'] | localize", where x is a number from 1 to 4.

Say we don't do custom url matching, we defer to a QuarterlyViewStatementsComponent when the url is not SEARCH_STATEMENTS.

To make matters worse:
Say we use history.state in QuarterlyViewStatementsComponent to retrieve some stuff from the routerlink,
Would the redirectTo solution mentioned in the README still work?

This seems to me like a situation, where it would be possible to determine the language, AND support the wildcard routes, but if and only when the wildcard route is a child of an already translated route.

Suggestion maybe?
Let me know.

@gilsdav
Copy link
Owner

gilsdav commented Nov 29, 2021

Hello @AntonVandeghinste ,
Sorry for the delay.
Do you still need help ?

@AntonVandeghinste
Copy link
Author

We worked around it by doing a little bit of manual navigation I think.
The suggestion (based on issue #36 where one is unable to change the language, because there's no indication if the language is present in the url) was just that whenever you have a wildcard route as child of a translated route you would know for a fact that the language is there.

I was facing this specific case, where in a wildcard child route i was unable to change the language.

I also haven't followed up on latest development, so if this is already a thing , or has been fixed/changed, you can safely close this thread.

Thanks!

@gilsdav gilsdav added the enhancement New feature or request label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants