File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed
components/sprite-selector Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import SpriteInfo from '../../containers/sprite-info.jsx';
77import SpriteList from './sprite-list.jsx' ;
88import ActionMenu from '../action-menu/action-menu.jsx' ;
99import { STAGE_DISPLAY_SIZES } from '../../lib/layout-constants' ;
10- import { rtlLocales } from '../../lib/locale-utils ' ;
10+ import { isRtl } from 'scratch-l10n ' ;
1111
1212import styles from './sprite-selector.css' ;
1313
@@ -140,7 +140,7 @@ const SpriteSelectorComponent = function (props) {
140140 }
141141 ] }
142142 title = { intl . formatMessage ( messages . addSpriteFromLibrary ) }
143- tooltipPlace = { rtlLocales . indexOf ( intl . locale ) === - 1 ? 'left' : 'right' }
143+ tooltipPlace = { isRtl ( intl . locale ) ? 'left' : 'right' }
144144 onClick = { onNewSpriteClick }
145145 />
146146 </ Box >
Original file line number Diff line number Diff line change 1- // TODO: this probably should be coming from scratch-l10n
2- // Tracking in https://github.com/LLK/scratch-l10n/issues/32
3- const rtlLocales = [ 'he' ] ;
1+ /**
2+ * @fileoverview
3+ * Utility functions related to localization specific to the GUI
4+ */
45
56const wideLocales = [
67 'ab' ,
@@ -16,12 +17,17 @@ const wideLocales = [
1617 'vi'
1718] ;
1819
20+ /**
21+ * Identify the languages where translations are too long to fit in fixed width parts of the gui.
22+ * @param {string } locale The current locale.
23+ * @return {bool } true if translations in this language are too long
24+ */
25+
1926const isWideLocale = locale => (
2027 wideLocales . indexOf ( locale ) !== - 1
2128) ;
2229
2330export {
24- rtlLocales ,
2531 wideLocales ,
2632 isWideLocale
2733} ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import {addLocaleData} from 'react-intl';
22
33import { localeData } from 'scratch-l10n' ;
44import editorMessages from 'scratch-l10n/locales/editor-msgs' ;
5- import { rtlLocales } from '../lib/locale-utils ' ;
5+ import { isRtl } from 'scratch-l10n ' ;
66
77addLocaleData ( localeData ) ;
88
@@ -21,7 +21,7 @@ const reducer = function (state, action) {
2121 switch ( action . type ) {
2222 case SELECT_LOCALE :
2323 return Object . assign ( { } , state , {
24- isRtl : rtlLocales . indexOf ( action . locale ) !== - 1 ,
24+ isRtl : isRtl ( action . locale ) ,
2525 locale : action . locale ,
2626 messagesByLocale : state . messagesByLocale ,
2727 messages : state . messagesByLocale [ action . locale ]
@@ -57,7 +57,7 @@ const initLocale = function (currentState, locale) {
5757 { } ,
5858 currentState ,
5959 {
60- isRtl : rtlLocales . indexOf ( locale ) !== - 1 ,
60+ isRtl : isRtl ( locale ) ,
6161 locale : locale ,
6262 messagesByLocale : currentState . messagesByLocale ,
6363 messages : currentState . messagesByLocale [ locale ]
You can’t perform that action at this time.
0 commit comments