-
Notifications
You must be signed in to change notification settings - Fork 248
Conversation
} else { | ||
store.dispatch(setLocale(DEFAULT_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.
If stuff like this, aren't you having different languages on a same url? So flash with default locale, then a rerendering with user 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.
I forgot to add the doc about "redirect to home page".
But yes, maybe we can imagine to test two urls and redirect to the same url with user locale if the url exists
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.
With this code, we have few seconds without translations. Do you think there is a way to add a general loader until the SET_LOCALE
action is dispatched ?
... | ||
updateLocale: (locale) => { | ||
dispatch(setLocale(locale)) | ||
browserHistory.push("/") |
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.
@MoOx If we want to redirect to the same url with other locale, we have to do here
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 think it's preferable to do this, to avoid potential flash with different languages (eg: full page refresh will give you that (bad) UX). Thoughts?
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.
Yes, we can't control user urls, so it could be difficult to handle this. It could be no locale in url potentially.
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 think for our documentation perspective, we should explain the pro/cons of both approach, but I think telling people to have an differents urls for each languages make more sense (eg: SEO). The case with a single page is imo bad for many reasons (weird ux, bad for seo, sharing url can lead to unexpected behavior (I share current page with fr but my friend will get default locale until he select fr)...)
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.
Good catch, I did forget this point
Any plan to update the doc according to your discussion? |
I will update the doc before the end of the week but I did not found a way to avoid the flash effect. |
I add a comment to explain why have uniq urls is a good thing. What do you think ? |
What is the benefit of using redux for this? As you pass this to the context too. |
I don't know the benefit of using redux here. Maybe we can write 2 separate docs :
Because I think a lot of people using react use also redux so they will be interested in it. |
I am ok for
If you want, we can keep what you made for 2. and I can take care of 1. (I am going to do that for my personal website). |
Ok I changed the label. Thank you for your help |
Please next time use this repo instead of your fork, this will make contributions easier for me :) |
Ok no problem :) |
No description provided.