-
Notifications
You must be signed in to change notification settings - Fork 471
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
[WIP] prefix_none strategy #165
Conversation
if (routePathLang && routePathLang.length === 2) { | ||
console.log('REDIRECTING TO ' + (route.path.slice(3) || '/')) | ||
locale = routePathLang | ||
app.i18n.switchLocale(locale) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"app.i18n.switchLocale is not a function"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 hmm that could be explain why it does not switch on the root route
Thsks @Magnum5234 for pointing that out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Magnum5234 which editor are you using?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use for all web related stuff PHP Storm
https://www.jetbrains.com/phpstorm/
When I remove the faulty line above, my cookie settings are not longer respected. Cookie is no longer stored when I visit the site. I will be stored however after the change. Also my strategy is no longer followed (language not longer applied to path). A short while after, the page breaks completely until I remove the language cookie again. That might be due to routing broken as the language path are no longer valid. ( I run my test project with:
|
So I guess we need more tests. |
What seems to currently be the problem? This PR kind of died. I'd love to help. |
The problem is that the current strategies do not fit for web apps with multi lang content, only websites. As for us the Lang setting only effects the ui language, not the content we don’t want to have any reference to the current Lang in the url and therefore need to switch the Lang also in place without switching the url. All of that is currently not possible and turned out to be very error prone in the current implementation as the tests also are more of an decoration then really useful atm. We gave up and implemented it on our own which turned out to be very simple. So at the Moment that PR is indeed dead but feel free to take it further if it is useful also for your case. Would be nice if the defacto standard community plugin would also work for multi Lang content sites. |
This PR has been inactive for a while, closing it for now. Hopefully, someone can pick this up, it would certainly be a nice feature to have. |
I need to be able to switch the language without a prefix as the locale is only used for the interface, not for the content (which can be multilingual).
Therefore I startet to add a
PREFIX_NONE
strategy.Problems to solve:
/
)PREFIX_NONE
strategy (found intest/fixture/prefix_none/
)How to test
node test/fixtures/prefix_none/start.js
ornode test/fixtures/basic/start.js
yarn jest test/fixtures/prefix_none
oryarn jest test/fixtures/basic