Conversation
* Added libraries i18nline and preact-i18nline
* Added a config that adds the preact-i18nline/webpack-loader
* Added a LanguagePicker component
* Modified the Header component
+ Translated the links
+ Made it render children
* Modified the App component
+ Import the i18n index file
+ Added LanguagePicker as a child of Header
+ When language selected, switch locale
+ When locale switched, re-render
* Added i18n config to package.json
+ auto-translate h1 and Link elements
* Added folder src/i18n
+ default.json: default translations as extracted from source
+ de.json: German translation messages
+ en.json: English translation messages
+ nl.json: Dutch translation messages
+ index.js: Index file that takes care of config and imports
vutran
reviewed
Apr 5, 2018
Collaborator
There was a problem hiding this comment.
I think this should be a class component instead of splitting it out into an SFC + listener handler method.
Collaborator
Author
There was a problem hiding this comment.
Yeah ok. Will change. Thanks!
vutran
approved these changes
Jul 23, 2018
Collaborator
Author
|
Maybe it's good to keep this as a separate branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I opened this PR mostly for discussion purposes. Don't merge it (yet).
This PR adds a language picker to the Header component and all other stuff needed to make that work. See the commit message, actual code (it's not that much) and the text in Chapter 9 of the book (will upload tonight, still working on it).
However, maybe it's better not to actually merge it and just leave it in it's own branch since it's a 'Next Step for a PWA' topic. Then again the language selection is kinda cool to showcase.... So I wonder about your opinions. What do you think?
Second is of course the code itself. Please let me know if something should change or maybe you have questions.
Last: I added Dutch (my own language) and German as I know it well enough. Maybe you guys want to add a language as well? Or would that be too much? Let me know!