Skip to content

Commit b7d17a0

Browse files
authored
Missing ARIA label NavBasic, Removing Italian entry from Language Dropdown, Changing translation for Asset (#1583)
* Removing i18 unused imports * Removing Italian from Language Dropddown in Nav * Adding ARIA Label in NavTest * Changing translation from "Asset" to "Recurso" for spanish * Assetlist bug, EditableInput.jsx QuickAddList.jsx StopPropogation error
1 parent b7ab455 commit b7d17a0

File tree

10 files changed

+21
-34
lines changed

10 files changed

+21
-34
lines changed

client/components/Nav.jsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -566,16 +566,6 @@ class Nav extends React.PureComponent {
566566
</button>
567567
<ul className="nav__dropdown">
568568

569-
<li className="nav__dropdown-item">
570-
<button
571-
onFocus={this.handleFocusForLang}
572-
onBlur={this.handleBlur}
573-
value="it"
574-
onClick={e => this.handleLangSelection(e)}
575-
>
576-
Italian (Test Fallback)
577-
</button>
578-
</li>
579569
<li className="nav__dropdown-item">
580570
<button
581571
onFocus={this.handleFocusForLang}

client/components/NavBasic.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3+
import { withTranslation } from 'react-i18next';
34

45
import LogoIcon from '../images/p5js-logo-small.svg';
56
import ArrowIcon from '../images/triangle-arrow-left.svg';
@@ -14,7 +15,7 @@ class NavBasic extends React.PureComponent {
1415
<nav className="nav" title="main-navigation" ref={(node) => { this.node = node; }}>
1516
<ul className="nav__items-left">
1617
<li className="nav__item-logo">
17-
<LogoIcon role="img" aria-label="p5.js Logo" focusable="false" className="svg__logo" />
18+
<LogoIcon role="img" aria-label={this.props.t('Common.p5logoARIA')} focusable="false" className="svg__logo" />
1819
</li>
1920
{ this.props.onBack && (
2021
<li className="nav__item">
@@ -34,6 +35,7 @@ class NavBasic extends React.PureComponent {
3435

3536
NavBasic.propTypes = {
3637
onBack: PropTypes.func,
38+
t: PropTypes.func.isRequired
3739
};
3840

39-
export default NavBasic;
41+
export default withTranslation()(NavBasic);

client/modules/IDE/components/AssetList.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ class AssetListRowBase extends React.Component {
6161
handleAssetDelete = () => {
6262
const { key, name } = this.props.asset;
6363
this.closeOptions();
64-
if (window.confirm(`Are you sure you want to delete "${name}"?`)) {
64+
if (window.confirm(this.props.t('Common.DeleteConfirmation', { name }))) {
6565
this.props.deleteAssetRequest(key);
6666
}
6767
}
6868

6969
render() {
70-
const { asset, username } = this.props;
70+
const { asset, username, t } = this.props;
7171
const { optionsOpen } = this.state;
7272
return (
7373
<tr className="asset-table__row" key={asset.key}>
@@ -86,7 +86,7 @@ class AssetListRowBase extends React.Component {
8686
onClick={this.toggleOptions}
8787
onBlur={this.onBlurComponent}
8888
onFocus={this.onFocusComponent}
89-
aria-label={this.props.t('AssetList.ToggleOpenCloseARIA')}
89+
aria-label={t('AssetList.ToggleOpenCloseARIA')}
9090
>
9191
<DownFilledTriangleIcon focusable="false" aria-hidden="true" />
9292
</button>
@@ -101,7 +101,7 @@ class AssetListRowBase extends React.Component {
101101
onBlur={this.onBlurComponent}
102102
onFocus={this.onFocusComponent}
103103
>
104-
{this.props.t('AssetList.Delete')}
104+
{t('AssetList.Delete')}
105105
</button>
106106
</li>
107107
<li>
@@ -112,7 +112,7 @@ class AssetListRowBase extends React.Component {
112112
onFocus={this.onFocusComponent}
113113
className="asset-table__action-option"
114114
>
115-
{this.props.t('AssetList.OpenNewTab')}
115+
{t('AssetList.OpenNewTab')}
116116
</Link>
117117
</li>
118118
</ul>}
@@ -194,7 +194,7 @@ class AssetList extends React.Component {
194194
</tr>
195195
</thead>
196196
<tbody>
197-
{assetList.map(asset => <AssetListRow asset={asset} key={asset.key} />)}
197+
{assetList.map(asset => <AssetListRow asset={asset} key={asset.key} t={t} />)}
198198
</tbody>
199199
</table>}
200200
</article>

client/modules/IDE/components/EditableInput.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import { withTranslation } from 'react-i18next';
3+
import { useTranslation } from 'react-i18next';
44
import i18next from 'i18next';
55
import EditIcon from '../../../images/pencil.svg';
66

@@ -22,7 +22,7 @@ function EditableInput({
2222
isEditing ? 'is-editing' : 'is-not-editing'
2323
} editable-input--${hasValue ? 'has-value' : 'has-placeholder'}`;
2424
const inputRef = React.createRef();
25-
25+
const { t } = useTranslation();
2626
React.useEffect(() => {
2727
if (isEditing) {
2828
inputRef.current.focus();
@@ -60,7 +60,7 @@ function EditableInput({
6060
<button
6161
className="editable-input__label"
6262
onClick={beginEditing}
63-
aria-label={this.props.t('EditableInput.EditValue', { display: displayValue })}
63+
aria-label={t('EditableInput.EditValue', { display: displayValue })}
6464
>
6565
<span>{displayValue}</span>
6666
<EditIcon
@@ -101,7 +101,6 @@ EditableInput.propTypes = {
101101
onChange: PropTypes.func.isRequired,
102102
validate: PropTypes.func,
103103
value: PropTypes.string,
104-
t: PropTypes.func.isRequired
105104
};
106105

107-
export default withTranslation()(EditableInput);
106+
export default EditableInput;

client/modules/IDE/components/QuickAddList/QuickAddList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Item = ({
1919
className="quick-add__item-view"
2020
to={url}
2121
target="_blank"
22-
onClick={e => e.stopPropogation()}
22+
onClick={e => e.stopPropagation()}
2323
>
2424
{t('QuickAddList.View')}
2525
</Link>

client/modules/IDE/reducers/preferences.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import i18next from 'i18next';
21
import * as ActionTypes from '../../../constants';
32

43

client/modules/User/components/LoginForm.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
33
import { withTranslation } from 'react-i18next';
4-
import i18n from 'i18next';
54
import Button from '../../../common/Button';
65

76
import { domOnlyProps } from '../../../utils/reduxFormUtils';

client/modules/User/components/SocialAuthButton.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
33
import styled from 'styled-components';
4-
import i18n from 'i18next';
54
import { withTranslation } from 'react-i18next';
65

76
import { remSize } from '../../../theme';

client/modules/User/pages/LoginView.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { reduxForm } from 'redux-form';
44
import { Link, browserHistory } from 'react-router';
55
import { Helmet } from 'react-helmet';
66
import { withTranslation } from 'react-i18next';
7-
import i18n from 'i18next';
87
import { validateAndLoginUser } from '../actions';
98
import LoginForm from '../components/LoginForm';
109
import { validateLogin } from '../../../utils/reduxFormUtils';

translations/locales/es-419/translations.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
"My": "Mi",
4444
"MySketches": "Mis bosquejos",
4545
"MyCollections": "Mis colecciones",
46-
"Asset": "Asset",
47-
"MyAssets": "Mis assets",
46+
"Asset": "Recurso",
47+
"MyAssets": "Mis recursos",
4848
"LogOut": "Cerrar sesión"
4949
}
5050
},
@@ -342,11 +342,11 @@
342342
"InvalidState": "Algo salió mal."
343343
},
344344
"AssetList": {
345-
"Title": "Editor Web p5.js | Mis assets",
346-
"ToggleOpenCloseARIA": "Alternar Abrir/Cerrar Opciones de Asset",
345+
"Title": "Editor Web p5.js | Mis recursos",
346+
"ToggleOpenCloseARIA": "Alternar Abrir/Cerrar Opciones de Recurso",
347347
"Delete": "Borrar",
348348
"OpenNewTab": "Abrir en Nueva Pestaña",
349-
"NoUploadedAssets": "No has subido archivos.",
349+
"NoUploadedAssets": "No has subido recursos.",
350350
"HeaderName": "Nombre",
351351
"HeaderSize": "Tamaño",
352352
"HeaderSketch": "Bosquejo"
@@ -439,7 +439,7 @@
439439
"DashboardTabSwitcher": {
440440
"Sketches": "Bosquejos",
441441
"Collections": "Colecciones ",
442-
"Assets": "Assets"
442+
"Assets": "Recursos"
443443
},
444444
"CollectionList": {
445445
"Title": "p5.js Web Editor | Mis colecciones",

0 commit comments

Comments
 (0)