Skip to content
Snippets Groups Projects
Commit 8da7e12f authored by chrisgarrity's avatar chrisgarrity
Browse files

Mirror the speaker icon for RTL languages

fixes #2983
parent f9fd7c90
No related branches found
No related tags found
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -132,11 +132,15 @@ ...@@ -132,11 +132,15 @@
margin-left: 0.125rem; margin-left: 0.125rem;
} }
/* only mirror blocks tab icon */ /* mirror blocks and sound tab icons */
[dir="rtl"] .tab:nth-of-type(1) img { [dir="rtl"] .tab:nth-of-type(1) img {
transform: scaleX(-1); transform: scaleX(-1);
} }
[dir="rtl"] .tab:nth-of-type(3) img {
transform: scaleX(-1);
}
.tab.is-selected img { .tab.is-selected img {
filter: none; filter: none;
} }
......
...@@ -149,6 +149,15 @@ $border-radius: 0.25rem; ...@@ -149,6 +149,15 @@ $border-radius: 0.25rem;
margin-bottom: -0.375rem; margin-bottom: -0.375rem;
} }
/* mirror the louder/softer speaker icons when rtl */
[dir="rtl"] .effect-button:nth-of-type(6) img {
transform: scaleX(-1);
}
[dir="rtl"] .effect-button:nth-of-type(7) img {
transform: scaleX(-1);
}
[dir="ltr"] .button-group { [dir="ltr"] .button-group {
margin-left: 1rem; margin-left: 1rem;
} }
......
...@@ -9,10 +9,13 @@ import analytics from '../lib/analytics'; ...@@ -9,10 +9,13 @@ import analytics from '../lib/analytics';
import LibraryComponent from '../components/library/library.jsx'; import LibraryComponent from '../components/library/library.jsx';
import soundIcon from '../components/asset-panel/icon--sound.svg'; import soundIcon from '../components/asset-panel/icon--sound.svg';
import soundIconRtl from '../components/asset-panel/icon--sound-rtl.svg';
import soundLibraryContent from '../lib/libraries/sounds.json'; import soundLibraryContent from '../lib/libraries/sounds.json';
import soundTags from '../lib/libraries/sound-tags'; import soundTags from '../lib/libraries/sound-tags';
import {connect} from 'react-redux';
const messages = defineMessages({ const messages = defineMessages({
libraryTitle: { libraryTitle: {
defaultMessage: 'Choose a Sound', defaultMessage: 'Choose a Sound',
...@@ -137,7 +140,7 @@ class SoundLibrary extends React.PureComponent { ...@@ -137,7 +140,7 @@ class SoundLibrary extends React.PureComponent {
} = sound; } = sound;
return { return {
_md5: md5, _md5: md5,
rawURL: soundIcon, rawURL: this.props.isRtl ? soundIconRtl : soundIcon,
...otherData ...otherData
}; };
}); });
...@@ -159,9 +162,19 @@ class SoundLibrary extends React.PureComponent { ...@@ -159,9 +162,19 @@ class SoundLibrary extends React.PureComponent {
SoundLibrary.propTypes = { SoundLibrary.propTypes = {
intl: intlShape.isRequired, intl: intlShape.isRequired,
isRtl: PropTypes.bool,
onNewSound: PropTypes.func.isRequired, onNewSound: PropTypes.func.isRequired,
onRequestClose: PropTypes.func, onRequestClose: PropTypes.func,
vm: PropTypes.instanceOf(VM).isRequired vm: PropTypes.instanceOf(VM).isRequired
}; };
export default injectIntl(SoundLibrary); const mapStateToProps = state => ({
isRtl: state.locales.isRtl
});
const mapDispatchToProps = () => ({});
export default injectIntl(connect(
mapStateToProps,
mapDispatchToProps
)(SoundLibrary));
...@@ -6,6 +6,7 @@ import VM from 'scratch-vm'; ...@@ -6,6 +6,7 @@ import VM from 'scratch-vm';
import AssetPanel from '../components/asset-panel/asset-panel.jsx'; import AssetPanel from '../components/asset-panel/asset-panel.jsx';
import soundIcon from '../components/asset-panel/icon--sound.svg'; import soundIcon from '../components/asset-panel/icon--sound.svg';
import soundIconRtl from '../components/asset-panel/icon--sound-rtl.svg';
import addSoundFromLibraryIcon from '../components/asset-panel/icon--add-sound-lib.svg'; import addSoundFromLibraryIcon from '../components/asset-panel/icon--add-sound-lib.svg';
import addSoundFromRecordingIcon from '../components/asset-panel/icon--add-sound-record.svg'; import addSoundFromRecordingIcon from '../components/asset-panel/icon--add-sound-record.svg';
import fileUploadIcon from '../components/action-menu/icon--file-upload.svg'; import fileUploadIcon from '../components/action-menu/icon--file-upload.svg';
...@@ -158,6 +159,7 @@ class SoundTab extends React.Component { ...@@ -158,6 +159,7 @@ class SoundTab extends React.Component {
const { const {
dispatchUpdateRestore, // eslint-disable-line no-unused-vars dispatchUpdateRestore, // eslint-disable-line no-unused-vars
intl, intl,
isRtl,
vm, vm,
onNewSoundFromLibraryClick, onNewSoundFromLibraryClick,
onNewSoundFromRecordingClick onNewSoundFromRecordingClick
...@@ -171,7 +173,7 @@ class SoundTab extends React.Component { ...@@ -171,7 +173,7 @@ class SoundTab extends React.Component {
const sounds = sprite.sounds ? sprite.sounds.map(sound => ( const sounds = sprite.sounds ? sprite.sounds.map(sound => (
{ {
url: soundIcon, url: isRtl ? soundIconRtl : soundIcon,
name: sound.name, name: sound.name,
details: (sound.sampleCount / sound.rate).toFixed(2), details: (sound.sampleCount / sound.rate).toFixed(2),
dragPayload: sound dragPayload: sound
...@@ -259,6 +261,7 @@ SoundTab.propTypes = { ...@@ -259,6 +261,7 @@ SoundTab.propTypes = {
dispatchUpdateRestore: PropTypes.func, dispatchUpdateRestore: PropTypes.func,
editingTarget: PropTypes.string, editingTarget: PropTypes.string,
intl: intlShape, intl: intlShape,
isRtl: PropTypes.bool,
onActivateCostumesTab: PropTypes.func.isRequired, onActivateCostumesTab: PropTypes.func.isRequired,
onNewSoundFromLibraryClick: PropTypes.func.isRequired, onNewSoundFromLibraryClick: PropTypes.func.isRequired,
onNewSoundFromRecordingClick: PropTypes.func.isRequired, onNewSoundFromRecordingClick: PropTypes.func.isRequired,
...@@ -282,6 +285,7 @@ SoundTab.propTypes = { ...@@ -282,6 +285,7 @@ SoundTab.propTypes = {
const mapStateToProps = state => ({ const mapStateToProps = state => ({
editingTarget: state.scratchGui.targets.editingTarget, editingTarget: state.scratchGui.targets.editingTarget,
isRtl: state.locales.isRtl,
sprites: state.scratchGui.targets.sprites, sprites: state.scratchGui.targets.sprites,
stage: state.scratchGui.targets.stage, stage: state.scratchGui.targets.stage,
soundLibraryVisible: state.scratchGui.modals.soundLibrary, soundLibraryVisible: state.scratchGui.modals.soundLibrary,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment