Skip to content

Commit a57a339

Browse files
alexcjohnsonVeraZab
authored andcommitted
Prettierier
1 parent 187566b commit a57a339

File tree

3 files changed

+67
-39
lines changed

3 files changed

+67
-39
lines changed

scripts/makeArrows.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,30 @@ function makeArrows() {
1717
const entries = lines
1818
.map(line => {
1919
const key = line.split(/\/\//)[0].trim();
20-
const escapedKey = key.replace(/\'/g, "\\'");
21-
const maybeQuoteKey = wordRE.test(key) ? key : "'" + escapedKey + "'";
20+
const quoteChar = key.indexOf("'") === -1 ? "'" : '"';
21+
22+
if (key.indexOf('"') !== -1) {
23+
throw new Error('double quotes are not supported, key: ' + key);
24+
}
25+
26+
const maybeQuoteKey = wordRE.test(key)
27+
? key
28+
: quoteChar + key + quoteChar;
2229
const arrowStr = arrowPad(getArrowLen(key));
2330

24-
return (
25-
' ' + maybeQuoteKey + ": '" + arrowStr + escapedKey + arrowStr + "'"
26-
);
31+
const quotedVal = quoteChar + arrowStr + key + arrowStr + quoteChar + ',';
32+
const singleLine = ' ' + maybeQuoteKey + ': ' + quotedVal;
33+
34+
if (singleLine.length <= 80) return singleLine;
35+
36+
return ' ' + maybeQuoteKey + ':\n ' + quotedVal;
2737
})
28-
.join(',\n');
38+
.join('\n');
2939

30-
const ignorePrettier = '/* eslint-disable prettier */';
3140
const head = 'export default {';
32-
const tail = '}';
41+
const tail = '};\n';
3342

34-
fs.writeFile(
35-
pathToArrowsOut,
36-
[ignorePrettier, head, entries, tail].join('\n')
37-
);
43+
fs.writeFile(pathToArrowsOut, [head, entries, tail].join('\n'));
3844
console.log('arrows mock translation written to: ' + pathToArrowsOut);
3945
}
4046

src/locales/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import xx from './xx';
33

44
export default {
55
en: en,
6-
xx: xx
6+
xx: xx,
77
};

src/locales/xx.js

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable prettier */
21
export default {
32
'Anchor Point': '⇚⇚Anchor Point⇚⇚',
43
Angle: '⇚Angle⇚',
@@ -21,27 +20,36 @@ export default {
2120
'Box Width': '⇚⇚Box Width⇚⇚',
2221
Canvas: '⇚Canvas⇚',
2322
Center: '⇚Center⇚',
24-
'Click to enter Colorscale title': '⇚⇚⇚⇚⇚Click to enter Colorscale title⇚⇚⇚⇚⇚',
25-
'Click to enter Component A title': '⇚⇚⇚⇚⇚⇚Click to enter Component A title⇚⇚⇚⇚⇚⇚',
26-
'Click to enter Component B title': '⇚⇚⇚⇚⇚⇚Click to enter Component B title⇚⇚⇚⇚⇚⇚',
27-
'Click to enter Component C title': '⇚⇚⇚⇚⇚⇚Click to enter Component C title⇚⇚⇚⇚⇚⇚',
23+
'Click to enter Colorscale title':
24+
'⇚⇚⇚⇚⇚Click to enter Colorscale title⇚⇚⇚⇚⇚',
25+
'Click to enter Component A title':
26+
'⇚⇚⇚⇚⇚⇚Click to enter Component A title⇚⇚⇚⇚⇚⇚',
27+
'Click to enter Component B title':
28+
'⇚⇚⇚⇚⇚⇚Click to enter Component B title⇚⇚⇚⇚⇚⇚',
29+
'Click to enter Component C title':
30+
'⇚⇚⇚⇚⇚⇚Click to enter Component C title⇚⇚⇚⇚⇚⇚',
2831
'Click to enter Plot title': '⇚⇚⇚⇚Click to enter Plot title⇚⇚⇚⇚',
2932
'Click to enter X axis title': '⇚⇚⇚⇚⇚Click to enter X axis title⇚⇚⇚⇚⇚',
3033
'Click to enter Y axis title': '⇚⇚⇚⇚⇚Click to enter Y axis title⇚⇚⇚⇚⇚',
3134
Color: '⇚Color⇚',
32-
'Common Case: An \'All\' tab might display this message because the X and Y tabs contain different settings.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚Common Case: An \'All\' tab might display this message because the X and Y tabs contain different settings.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
35+
"Common Case: An 'All' tab might display this message because the X and Y tabs contain different settings.":
36+
"⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚Common Case: An 'All' tab might display this message because the X and Y tabs contain different settings.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚",
3337
'Compare data on hover': '⇚⇚⇚⇚Compare data on hover⇚⇚⇚⇚',
3438
Connect: '⇚Connect⇚',
3539
'Connect Gaps': '⇚⇚Connect Gaps⇚⇚',
3640
Continue: '⇚Continue⇚',
37-
'Continuing will convert your LaTeX expression into raw text.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚Continuing will convert your LaTeX expression into raw text.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
38-
'Continuing will convert your note to LaTeX-style text.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚Continuing will convert your note to LaTeX-style text.⇚⇚⇚⇚⇚⇚⇚⇚⇚',
39-
'Continuing will remove your expression.': '⇚⇚⇚⇚⇚⇚⇚Continuing will remove your expression.⇚⇚⇚⇚⇚⇚⇚',
41+
'Continuing will convert your LaTeX expression into raw text.':
42+
'⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚Continuing will convert your LaTeX expression into raw text.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
43+
'Continuing will convert your note to LaTeX-style text.':
44+
'⇚⇚⇚⇚⇚⇚⇚⇚⇚Continuing will convert your note to LaTeX-style text.⇚⇚⇚⇚⇚⇚⇚⇚⇚',
45+
'Continuing will remove your expression.':
46+
'⇚⇚⇚⇚⇚⇚⇚Continuing will remove your expression.⇚⇚⇚⇚⇚⇚⇚',
4047
Custom: '⇚Custom⇚',
4148
'Custom Color': '⇚⇚Custom Color⇚⇚',
4249
'Default Colors': '⇚⇚Default Colors⇚⇚',
4350
Display: '⇚Display⇚',
44-
'Double-click on legend to isolate one trace': '⇚⇚⇚⇚⇚⇚⇚⇚Double-click on legend to isolate one trace⇚⇚⇚⇚⇚⇚⇚⇚',
51+
'Double-click on legend to isolate one trace':
52+
'⇚⇚⇚⇚⇚⇚⇚⇚Double-click on legend to isolate one trace⇚⇚⇚⇚⇚⇚⇚⇚',
4553
'Double-click to zoom back out': '⇚⇚⇚⇚⇚Double-click to zoom back out⇚⇚⇚⇚⇚',
4654
'Download plot as a png': '⇚⇚⇚⇚Download plot as a png⇚⇚⇚⇚',
4755
'Edit in Chart Studio': '⇚⇚⇚⇚Edit in Chart Studio⇚⇚⇚⇚',
@@ -55,14 +63,17 @@ export default {
5563
'Font Size': '⇚⇚Font Size⇚⇚',
5664
'Global Font': '⇚⇚Global Font⇚⇚',
5765
'Go back': '⇚Go back⇚',
58-
'Go to the \'Create\' tab to define traces.': '⇚⇚⇚⇚⇚⇚⇚Go to the \'Create\' tab to define traces.⇚⇚⇚⇚⇚⇚⇚',
66+
"Go to the 'Create' tab to define traces.":
67+
"⇚⇚⇚⇚⇚⇚⇚Go to the 'Create' tab to define traces.⇚⇚⇚⇚⇚⇚⇚",
5968
'Heads up!': '⇚⇚Heads up!⇚⇚',
6069
Hide: '⇚Hide⇚',
6170
Horizontal: '⇚⇚Horizontal⇚⇚',
6271
'Horizontal Positioning': '⇚⇚⇚⇚Horizontal Positioning⇚⇚⇚⇚',
63-
'IE only supports svg. Changing format to svg.': '⇚⇚⇚⇚⇚⇚⇚⇚IE only supports svg. Changing format to svg.⇚⇚⇚⇚⇚⇚⇚⇚',
72+
'IE only supports svg. Changing format to svg.':
73+
'⇚⇚⇚⇚⇚⇚⇚⇚IE only supports svg. Changing format to svg.⇚⇚⇚⇚⇚⇚⇚⇚',
6474
LaTeX: '⇚LaTeX⇚',
65-
'LaTeX is a math typesetting language that doesn\'t work with rich text.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚LaTeX is a math typesetting language that doesn\'t work with rich text.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
75+
"LaTeX is a math typesetting language that doesn't work with rich text.":
76+
"⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚LaTeX is a math typesetting language that doesn't work with rich text.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚",
6677
'Lasso Select': '⇚⇚Lasso Select⇚⇚',
6778
Layout: '⇚Layout⇚',
6879
Left: '⇚Left⇚',
@@ -72,7 +83,8 @@ export default {
7283
'Line Width': '⇚⇚Line Width⇚⇚',
7384
Linear: '⇚Linear⇚',
7485
Lines: '⇚Lines⇚',
75-
'Looks like there aren\'t any traces defined yet.': '⇚⇚⇚⇚⇚⇚⇚⇚Looks like there aren\'t any traces defined yet.⇚⇚⇚⇚⇚⇚⇚⇚',
86+
"Looks like there aren't any traces defined yet.":
87+
"⇚⇚⇚⇚⇚⇚⇚⇚Looks like there aren't any traces defined yet.⇚⇚⇚⇚⇚⇚⇚⇚",
7688
'Margin Color': '⇚⇚Margin Color⇚⇚',
7789
'Margins and Padding': '⇚⇚⇚Margins and Padding⇚⇚⇚',
7890
Max: '⇚Max⇚',
@@ -100,10 +112,12 @@ export default {
100112
'Reset camera to last save': '⇚⇚⇚⇚Reset camera to last save⇚⇚⇚⇚',
101113
'Reset view': '⇚⇚Reset view⇚⇚',
102114
'Reset views': '⇚⇚Reset views⇚⇚',
103-
'Return to the Graph > Create menu above to add data.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚Return to the Graph > Create menu above to add data.⇚⇚⇚⇚⇚⇚⇚⇚⇚',
115+
'Return to the Graph > Create menu above to add data.':
116+
'⇚⇚⇚⇚⇚⇚⇚⇚⇚Return to the Graph > Create menu above to add data.⇚⇚⇚⇚⇚⇚⇚⇚⇚',
104117
Reversed: '⇚Reversed⇚',
105118
'Rich Text': '⇚⇚Rich Text⇚⇚',
106-
'Rich text is incompatible with LaTeX.': '⇚⇚⇚⇚⇚⇚Rich text is incompatible with LaTeX.⇚⇚⇚⇚⇚⇚',
119+
'Rich text is incompatible with LaTeX.':
120+
'⇚⇚⇚⇚⇚⇚Rich text is incompatible with LaTeX.⇚⇚⇚⇚⇚⇚',
107121
Right: '⇚Right⇚',
108122
Scale: '⇚Scale⇚',
109123
Selection: '⇚⇚Selection⇚⇚',
@@ -113,26 +127,34 @@ export default {
113127
Size: '⇚Size⇚',
114128
'Size and Spacing': '⇚⇚⇚Size and Spacing⇚⇚⇚',
115129
'Snapshot succeeded': '⇚⇚⇚Snapshot succeeded⇚⇚⇚',
116-
'Sorry, there was a problem downloading your snapshot!': '⇚⇚⇚⇚⇚⇚⇚⇚⇚Sorry, there was a problem downloading your snapshot!⇚⇚⇚⇚⇚⇚⇚⇚⇚',
130+
'Sorry, there was a problem downloading your snapshot!':
131+
'⇚⇚⇚⇚⇚⇚⇚⇚⇚Sorry, there was a problem downloading your snapshot!⇚⇚⇚⇚⇚⇚⇚⇚⇚',
117132
Symbol: '⇚Symbol⇚',
118-
'Taking snapshot - this may take a few seconds': '⇚⇚⇚⇚⇚⇚⇚⇚Taking snapshot - this may take a few seconds⇚⇚⇚⇚⇚⇚⇚⇚',
133+
'Taking snapshot - this may take a few seconds':
134+
'⇚⇚⇚⇚⇚⇚⇚⇚Taking snapshot - this may take a few seconds⇚⇚⇚⇚⇚⇚⇚⇚',
119135
Text: '⇚Text⇚',
120136
'Text Attributes': '⇚⇚⇚Text Attributes⇚⇚⇚',
121-
'The anchor point determines which side of the annotation\'s positioning coordinates refer to.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚The anchor point determines which side of the annotation\'s positioning coordinates refer to.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
122-
'The positioning inputs are relative to the anchor points on the text box.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚The positioning inputs are relative to the anchor points on the text box.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
123-
'This input has multiple values associated with it. Changing this setting will override these custom inputs.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚This input has multiple values associated with it. Changing this setting will override these custom inputs.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
124-
'This trace does not yet have any data.': '⇚⇚⇚⇚⇚⇚⇚This trace does not yet have any data.⇚⇚⇚⇚⇚⇚⇚',
137+
"The anchor point determines which side of the annotation's positioning coordinates refer to.":
138+
"⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚The anchor point determines which side of the annotation's positioning coordinates refer to.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚",
139+
'The positioning inputs are relative to the anchor points on the text box.':
140+
'⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚The positioning inputs are relative to the anchor points on the text box.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
141+
'This input has multiple values associated with it. Changing this setting will override these custom inputs.':
142+
'⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚This input has multiple values associated with it. Changing this setting will override these custom inputs.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
143+
'This trace does not yet have any data.':
144+
'⇚⇚⇚⇚⇚⇚⇚This trace does not yet have any data.⇚⇚⇚⇚⇚⇚⇚',
125145
'Tick Labels': '⇚⇚Tick Labels⇚⇚',
126146
'Tick Markers': '⇚⇚Tick Markers⇚⇚',
127147
Title: '⇚Title⇚',
128148
'Title and Fonts': '⇚⇚⇚Title and Fonts⇚⇚⇚',
129149
Titles: '⇚Titles⇚',
130150
'Toggle Spike Lines': '⇚⇚⇚Toggle Spike Lines⇚⇚⇚',
131-
'Toggle show closest data on hover': '⇚⇚⇚⇚⇚⇚Toggle show closest data on hover⇚⇚⇚⇚⇚⇚',
151+
'Toggle show closest data on hover':
152+
'⇚⇚⇚⇚⇚⇚Toggle show closest data on hover⇚⇚⇚⇚⇚⇚',
132153
Top: '⇚Top⇚',
133154
Trace: '⇚Trace⇚',
134155
'Trace Order': '⇚⇚Trace Order⇚⇚',
135-
'Trace opacity is not supported for a scatter trace with fill or for a scatter trace that gets filled by another scatter trace.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚Trace opacity is not supported for a scatter trace with fill or for a scatter trace that gets filled by another scatter trace.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
156+
'Trace opacity is not supported for a scatter trace with fill or for a scatter trace that gets filled by another scatter trace.':
157+
'⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚Trace opacity is not supported for a scatter trace with fill or for a scatter trace that gets filled by another scatter trace.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
136158
'Turntable rotation': '⇚⇚⇚Turntable rotation⇚⇚⇚',
137159
Type: '⇚Type⇚',
138160
Typeface: '⇚Typeface⇚',
@@ -169,5 +191,5 @@ export default {
169191
'source:': '⇚source:⇚',
170192
'target:': '⇚target:⇚',
171193
trace: '⇚trace⇚',
172-
'upper fence:': '⇚⇚upper fence:⇚⇚'
173-
}
194+
'upper fence:': '⇚⇚upper fence:⇚⇚',
195+
};

0 commit comments

Comments
 (0)