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

Internationalized routes in translation files #30098

Open
Seb33300 opened this Issue Feb 7, 2019 · 6 comments

Comments

Projects
None yet
5 participants
@Seb33300
Copy link
Contributor

Seb33300 commented Feb 7, 2019

Hello,

It seems to be possible to translate routes only from routes configurations files.

Is there any reason that this was not implemented to be part of the translator so routes could be translated into translation files (including xliff)?

@nicolas-grekas

This comment has been minimized.

Copy link
Member

nicolas-grekas commented Feb 7, 2019

There is always one reason you can be certain of: because nobody sent a PR to achieve so :)
If you want to give it a try, PR welcome as usual!

@sstok

This comment has been minimized.

Copy link
Contributor

sstok commented Feb 10, 2019

Now that it's part of the routing component it should not be to hard anymore, in the past bundles that provided this had to replace the routing service.


If you traverse all the collected routes and look-up their name in a translation service you can determine the translated values and update the route definitions accordingly. And don't forget about about default values!

Thinking of something like this for the translation file (per locale):

# routes.en.yaml
route_name:
   path: # translated path
   defaults: {  } # note: these are merged into a single string like "route_name.defaults.name"

I am leaving these notes here as an idea for anyone who wants to work on this, I don't have the time to do it myself.

@delirehberi

This comment has been minimized.

Copy link

delirehberi commented Feb 10, 2019

I remember, this was already discussed before. This feature not implemented cause of "it`s a specific problem for multi language websites". Also there was not exists a solution for route annotation.

@Seb33300

This comment has been minimized.

Copy link
Contributor Author

Seb33300 commented Feb 11, 2019

it`s a specific problem for multi language websites

???

Of course translations are specific to multi languages websites 🤷🏻‍♂️

@delirehberi

This comment has been minimized.

Copy link

delirehberi commented Feb 11, 2019

Yes, its specific to multi languages websites.

I want to say, it's not only about translation, or not an only routing problem. It`s the cause of increase dependency between routing and translation components if someone implemented this feature. So, it is should be resolved with an extra bundle or custom implementations. Because not every ones need this feature who used routing components or translation component.

So for me this feature broking separation of concern rule.

@Seb33300

This comment has been minimized.

Copy link
Contributor Author

Seb33300 commented Feb 11, 2019

The dependency could be optional.
Routing component should not require Translation component until we want to use route translations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment