-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
i18n paths #84
Comments
Can you describe a more realistic use case? What kind of page? For example for static routes with unicode characters need to use encoded path (because HTTP does not allow characters outside the ASCII range): const route = {
path: '/caf%C3%A9', // encodeURI('/café') or `/${encodeURIComponent('café')}`
action(context) {
console.log(context.path) // => '/caf%C3%A9'
},
};
const location = new URL('http://example.com/café'); // like window.location
location.pathname // => '/caf%C3%A9'
UniversalRouter.resolve(route, location.pathname); But in your case probably need to use dynamic path params: const route = {
path: '/:name',
action(context, params) {
if (params.name === 'café') { // or check for any localized paths
return 'page';
}
return null; // page not found
}
}; |
@frenzzy, thanks for the feedback. With your help, I was able to get it running! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I've been banging my head on this one.
Using react-intl, how can I go from
to
Thanks! #
The text was updated successfully, but these errors were encountered: