Skip to content

Prototype with proposed i18n architecture #1478

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

Merged
merged 17 commits into from
Jul 6, 2020
Merged

Conversation

oruburos
Copy link
Collaborator

@oruburos oruburos commented Jun 28, 2020

Fixes #1434 , Fixes #1447
I have verified that this pull request:

  • has no linting errors (npm run lint)
  • is descriptively named and links to an issue number, i.e. Fixes #123

@welcome
Copy link

welcome bot commented Jun 28, 2020

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already.

Copy link
Member

@andrewn andrewn left a comment

Choose a reason for hiding this comment

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

This is so exciting and is looking very good!

As this PR is being merged into develop it'll get deployed to production when we do the next release. So it's important that anything that isn't finished is hidden behind a feature flag (using an environment variable). Nav.jsx has a few examples where this is done.

It's a bit tricky for this work but I'd suggest:

  • we figure out a nice "loading" screen to use so users don't see the white page and "loading translations"
  • we hide the language switcher so users only see the english default language

That way we can continue with this work in small PRs but users don't see any changes.

);
}

renderLanguageMenu(navDropdownState) {
Copy link
Member

Choose a reason for hiding this comment

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

Until we're ready to make this live for users, we should hide the language switcher behind an environment variable. You can use other examples in this component as an example.

>
New
</button>
<Translation ns="Menu">
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about using the withTranslation HoC instead of this Translation component?

I think it would be clearer to see what's actually being changed in these files as we'd wrap Nav in withTranslation('Menu')(Nav) at the bottom of the file and then use this.props.t('key').

This would avoid indenting all the files and would be less changes in the PR diff views.

oruburos added 4 commits June 29, 2020 20:52
Debug to false
comments in server and change of path in server.js
comments in server and change of path in server.js
Uses WithTranslation In Nav
@catarak
Copy link
Member

catarak commented Jul 1, 2020

Amazing work! This is so exciting ✨

oruburos added 9 commits July 2, 2020 13:12
Warning if unsaved translated
Expanded label for languages
# Conflicts:
#	client/components/Nav.jsx
#	client/i18n.js
#	client/index.jsx
#	client/modules/IDE/components/Toast.jsx
#	package-lock.json
#	server/server.js
Copy link
Member

@andrewn andrewn left a comment

Choose a reason for hiding this comment

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

Great work!

@andrewn andrewn merged commit b05d1b1 into processing:develop Jul 6, 2020
@@ -79,6 +79,7 @@ app.options('*', corsMiddleware);
app.use(Express.static(path.resolve(__dirname, '../dist/static'), {
maxAge: process.env.STATIC_MAX_AGE || (process.env.NODE_ENV === 'production' ? '1d' : '0')
}));
app.use('/translations', Express.static('translations/locales/'));
Copy link
Member

Choose a reason for hiding this comment

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

Rather than serve the translations statically, would it instead be better to bundle them in with the webpack build? Unfortunately, serving the files this way breaks the application in production, because they are not copied in the Docker build. On the staging server, fetching the translations is returning a 404 error.

cc @andrewn

Copy link
Member

Choose a reason for hiding this comment

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

Or, the Dockerfile needs to be updated to copy the translations.

Copy link
Member

Choose a reason for hiding this comment

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

Or or, the webpack prod configuration needs to be updated so that it copies the files into dist/static

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I didn’t realise that, sorry.

The translations shouldn’t be in the bundle as we don’t want users to have to download languages they won’t use. But I guess copying the translations into dist/static would be simplest.

Copy link
Member

Choose a reason for hiding this comment

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

No worries at all! Let me know if y'all need any help with this.

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.

i18n library Web Editor in Spanish / Consistency with Languages Selection in p5 website
3 participants