Skip to content

Commit d68c5f3

Browse files
authored
Merge pull request #169 from plotly/list-all-localized-strings
Add script to extract locale strings
2 parents f0be772 + af5d315 commit d68c5f3

File tree

9 files changed

+427
-17
lines changed

9 files changed

+427
-17
lines changed

package-lock.json

Lines changed: 183 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"url": "https://github.com/plotly/react-plotly.js-editor/issues"
1414
},
1515
"scripts": {
16+
"find-strings": "babel-node utils/findLocaleStrings.js",
1617
"make:lib": "mkdirp lib && babel src --out-dir lib --ignore=__tests__/* --source-maps && npm run make:lib:css",
1718
"make:lib:css": "mkdirp lib && node-sass src/styles/main.scss > lib/react-plotly.js-editor.css",
1819
"make:dist": "mkdirp dist && browserify src/PlotlyEditor.js -o ./dist/PlotlyEditor.js -t [ babelify --presets [ es2015 react ] ] -t browserify-global-shim --standalone createPlotlyComponent && uglifyjs ./dist/PlotlyEditor.js --compress --mangle --output ./dist/PlotlyEditor.min.js --source-map filename=dist/PlotlyEditor.min.js.map && make:dist:css",
@@ -39,10 +40,13 @@
3940
],
4041
"devDependencies": {
4142
"babel-cli": "^6.26.0",
43+
"babel-core": "^6.26.0",
4244
"babel-eslint": "^8.0.2",
4345
"babel-plugin-transform-object-rest-spread": "^6.26.0",
4446
"babel-preset-es2015": "^6.24.1",
4547
"babel-preset-react": "^6.24.1",
48+
"babel-preset-stage-2": "^6.24.1",
49+
"babel-traverse": "^6.26.0",
4650
"babelify": "^7.3.0",
4751
"browserify": "^14.5.0",
4852
"classnames": "^2.2.5",

src/DefaultEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class DefaultEditor extends Component {
387387
<Info>
388388
{_(
389389
'The positioning inputs are relative to the ' +
390-
'anchor points on the text box'
390+
'anchor points on the text box.'
391391
)}
392392
</Info>
393393
<Radio

src/components/fields/Field.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, {Component} from 'react';
33
import MenuPanel from '../containers/MenuPanel';
44
import classnames from 'classnames';
55
import {bem, localize} from '../../lib';
6-
import {multiValueText} from '../../lib/constants';
6+
import {getMultiValueText} from '../../lib/constants';
77

88
class Field extends Component {
99
renderPostfix() {
@@ -48,10 +48,12 @@ class Field extends Component {
4848
<div className={fieldClass}>
4949
{children}
5050
{multiValued ? (
51-
<MenuPanel label={_(multiValueText.title)} ownline question>
52-
<div className="info__title">{_(multiValueText.title)}</div>
53-
<div className="info__text">{_(multiValueText.text)}</div>
54-
<div className="info__sub-text">{_(multiValueText.subText)}</div>
51+
<MenuPanel label={getMultiValueText('title', _)} ownline question>
52+
<div className="info__title">{getMultiValueText('title', _)}</div>
53+
<div className="info__text">{getMultiValueText('text', _)}</div>
54+
<div className="info__sub-text">
55+
{getMultiValueText('subText', _)}
56+
</div>
5557
</MenuPanel>
5658
) : null}
5759
</div>

src/components/widgets/ColorPicker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const CustomColorPicker = localize(
4949
return (
5050
<div>
5151
<div>
52-
<p className="colorpicker__title">{_('Custom colors')}</p>
52+
<p className="colorpicker__title">{_('Custom Colors')}</p>
5353
<div className="colorpicker__saturation">
5454
<Saturation {...props} />
5555
</div>
@@ -72,7 +72,7 @@ const CustomColorPicker = localize(
7272
</div>
7373
</div>
7474
<div>
75-
<p className="colorpicker__title">{_('Default colors')}</p>
75+
<p className="colorpicker__title">{_('Default Colors')}</p>
7676
<div className="colorpicker__preset-colors">
7777
<PresetColors colors={defaultColors} onClick={onChangeComplete} />
7878
</div>

src/components/widgets/text_editors/RichText/LinkEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class LinkEditor extends Component {
8989
render() {
9090
const {position} = this.state;
9191
const {onBlur, onFocus, linkURL, localize: _} = this.props;
92-
const placeholderText = _('Enter link URL');
92+
const placeholderText = _('Enter Link URL');
9393
const urlText = _('URL');
9494

9595
return (

src/lib/constants.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ export const MULTI_VALUED = '\x1bMIXED_VALUES';
1313
// how mixed values are represented in text inputs
1414
export const MULTI_VALUED_PLACEHOLDER = '---';
1515

16-
export const multiValueText = {
17-
title: 'Multiple Values',
18-
text:
19-
'This input has multiple values associated with it. ' +
20-
'Changing this setting will override these custom inputs.',
21-
subText:
22-
"Common Case: An 'All' tab might display this message " +
23-
'because the X and Y tabs contain different settings.',
16+
export const getMultiValueText = (key, _) => {
17+
const multiValueText = {
18+
title: _('Multiple Values'),
19+
text: _(
20+
'This input has multiple values associated with it. ' +
21+
'Changing this setting will override these custom inputs.'
22+
),
23+
subText: _(
24+
"Common Case: An 'All' tab might display this message " +
25+
'because the X and Y tabs contain different settings.'
26+
),
27+
};
28+
return multiValueText[key];
2429
};
2530

2631
export const EDITOR_ACTIONS = {

0 commit comments

Comments
 (0)