Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Add doc for internationalization #840

Merged
merged 3 commits into from
Nov 8, 2016
Merged

Add doc for internationalization #840

merged 3 commits into from
Nov 8, 2016

Conversation

cedricdelpoux
Copy link
Contributor

No description provided.

} else {
store.dispatch(setLocale(DEFAULT_LOCALE))
}
```
Copy link
Owner

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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 ?

@MoOx MoOx added the docs label Oct 24, 2016
...
updateLocale: (locale) => {
dispatch(setLocale(locale))
browserHistory.push("/")
Copy link
Contributor Author

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

Copy link
Owner

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?

Copy link
Contributor Author

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.

Copy link
Owner

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)...)

Copy link
Contributor Author

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

@MoOx
Copy link
Owner

MoOx commented Oct 28, 2016

Any plan to update the doc according to your discussion?

@cedricdelpoux
Copy link
Contributor Author

I will update the doc before the end of the week but I did not found a way to avoid the flash effect.
Maybe with #855, we could add a delay or handle the dispatch response.

@cedricdelpoux
Copy link
Contributor Author

I add a comment to explain why have uniq urls is a good thing. What do you think ?

@MoOx
Copy link
Owner

MoOx commented Nov 4, 2016

What is the benefit of using redux for this? As you pass this to the context too.
I think we should better offer simpler instructions without redux (since we are going to remove it).

@cedricdelpoux
Copy link
Contributor Author

I don't know the benefit of using redux here.
I always used redux to manage my app state so I don't really know how to manage it without redux.
I need help to write the doc about it.

Maybe we can write 2 separate docs :

  • with redux
  • without redux

Because I think a lot of people using react use also redux so they will be interested in it.

@MoOx
Copy link
Owner

MoOx commented Nov 5, 2016

I am ok for

  1. without redux
  2. without redux

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).

@cedricdelpoux
Copy link
Contributor Author

Ok I changed the label. Thank you for your help

@MoOx
Copy link
Owner

MoOx commented Nov 8, 2016

Please next time use this repo instead of your fork, this will make contributions easier for me :)

@cedricdelpoux
Copy link
Contributor Author

cedricdelpoux commented Nov 8, 2016

Ok no problem :)

MoOx added a commit that referenced this pull request Nov 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants