Skip to content

#1559 Internationalize mobile text using i18n #1581

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

Conversation

ridait
Copy link
Contributor

@ridait ridait commented Aug 26, 2020

Fixes #1559

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • is from a uniquely-named feature branch and has been rebased on top of the latest master. (If I was asked to make more changes, I have made sure to rebase onto master then too)
  • is descriptively named and links to an issue number, i.e. Fixes #1559

Copy link
Collaborator

@ghalestrilo ghalestrilo left a comment

Choose a reason for hiding this comment

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

Buen trabajo! :)
This looks great, there's just one quick change to do

</Sidebar>
);
const Explorer = ({ id, canEdit, onPressClose }) => {
const { t, i18n } = useTranslation();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think you need the i18n prop here, because the t prop is the only one you use. What happens if you remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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 looking great! It'd be great if the first part of the translation key could be named after the component/filename. This makes it easier to figure out the link between a component and its translation in the language JSON files.

I've left some examples of this in the code comments.

Thanks!

const Explorer = ({ id, canEdit, onPressClose }) => {
const { t, i18n } = useTranslation();
return (
<Sidebar title={t('MobileSideBar.Files')} onPressClose={onPressClose}>
Copy link
Member

Choose a reason for hiding this comment

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

It'd be great if the first part of the translation key can be named after the component/filename. So this would be Explorer. This makes it easier to figure out the link between the translation language files and the components.

Suggested change
<Sidebar title={t('MobileSideBar.Files')} onPressClose={onPressClose}>
<Sidebar title={t('Explorer.Files')} onPressClose={onPressClose}>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

const { t, i18n } = useTranslation();
return [
{
value: true, label: t('Preferences.On'), ariaLabel: `${name} on`, name: `${name}`, id: `${name}-on`.replace(' ', '-')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
value: true, label: t('Preferences.On'), ariaLabel: `${name} on`, name: `${name}`, id: `${name}-on`.replace(' ', '-')
value: true, label: t('PreferenceCreators.On'), ariaLabel: `${name} on`, name: `${name}`, id: `${name}-on`.replace(' ', '-')

{ icon: PreferencesIcon, title: 'Examples', href: '/p5/sketches' },
{ icon: PreferencesIcon, title: 'Original Editor', action: toggleForceDesktop, },
{ icon: PreferencesIcon, title: 'Logout', action: logoutUser, },
{ icon: PreferencesIcon, title: t('MobileNav.Preferences'), href: '/preferences', },
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{ icon: PreferencesIcon, title: t('MobileNav.Preferences'), href: '/preferences', },
{ icon: PreferencesIcon, title: t('MobileIDEView.Preferences'), href: '/preferences', },

ridait and others added 5 commits August 28, 2020 18:53
* New language selector design
* Adjust authenticated nav to consolidate Account dropdown
* Adding language in NavTest

Co-authored-by: Cassie Tarakajian <ctarakajian@gmail.com>
@ridait ridait requested review from andrewn and ghalestrilo August 28, 2020 17:15
@catarak
Copy link
Member

catarak commented Sep 2, 2020

It seems like all of your comments @andrewn and @ghalestrilo have been resolved. Okay to merge?

@catarak catarak merged commit 144f68c into processing:develop Sep 23, 2020
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.

Internationalize mobile text
5 participants