Skip to content

DON'T MERGE (yet): Added I18n support: German and Dutch languages#6

Open
Download wants to merge 3 commits intomasterfrom
i18n
Open

DON'T MERGE (yet): Added I18n support: German and Dutch languages#6
Download wants to merge 3 commits intomasterfrom
i18n

Conversation

@Download
Copy link
Collaborator

@Download Download commented Apr 5, 2018

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!

 * 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a class component instead of splitting it out into an SFC + listener handler method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah ok. Will change. Thanks!

@Download
Copy link
Collaborator Author

Maybe it's good to keep this as a separate branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments