Skip to content

Commit 82f77ef

Browse files
alexcjohnsonVeraZab
authored andcommitted
make and write an arrows translation we can use for testing
1 parent 8688032 commit 82f77ef

File tree

4 files changed

+228
-0
lines changed

4 files changed

+228
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"lint": "prettier --write \"src/**/*.js\"",
1717
"make:combined-translation-keys": "babel-node scripts/findTranslationKeys.js && babel-node scripts/combineTranslationKeys.js",
1818
"make:translation-keys": "babel-node scripts/findTranslationKeys.js",
19+
"make:arrows": "babel-node scripts/makeArrows.js",
1920
"make:lib": "mkdirp lib && npm run make:lib:js && npm run make:lib:css",
2021
"make:lib:js": "mkdirp lib && babel src --out-dir lib --ignore=__tests__/* --source-maps",
2122
"make:lib:css": "mkdirp lib && babel-node scripts/styles.js && SASS_ENV=ie babel-node scripts/styles.js && babel-node scripts/postcss.js && SASS_ENV=ie babel-node scripts/postcss.js",

scripts/makeArrows.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import path from 'path';
2+
import fs from 'fs';
3+
4+
const pathToCombinedTranslationKeys = path.join(
5+
__dirname,
6+
'./translationKeys/combined-translation-keys.txt'
7+
);
8+
9+
const pathToArrowsOut = path.join(
10+
__dirname,
11+
'../src/locales/xx.js'
12+
);
13+
14+
const wordRE = /^[A-Za-z]+$/;
15+
16+
function makeArrows() {
17+
const lines = fs.readFileSync(pathToCombinedTranslationKeys, 'utf-8').split(/\r?\n/);
18+
const entries = lines.map(line => {
19+
const key = line.split(/\/\//)[0].trim();
20+
const escapedKey = key.replace(/\'/g, '\\\'');
21+
const maybeQuoteKey = wordRE.test(key) ? key : '\'' + escapedKey + '\'';
22+
const arrowStr = arrowPad(getArrowLen(key));
23+
24+
return ' ' + maybeQuoteKey + ': \'' + arrowStr + escapedKey + arrowStr + '\'';
25+
}).join(',\n');
26+
27+
const head = 'export default {';
28+
const tail = '}';
29+
30+
fs.writeFile(pathToArrowsOut, [head, entries, tail].join('\n'))
31+
console.log('arrows mock translation written to: ' + pathToArrowsOut);
32+
}
33+
34+
// inferred from the arrow file Greg provided
35+
function getArrowLen(key) {
36+
return Math.max(1, Math.round(key.length / 5.7));
37+
}
38+
39+
function arrowPad(n) {
40+
let out = '';
41+
for(let i = 0; i < n; i++) {
42+
out += '⇚';
43+
}
44+
return out;
45+
}
46+
47+
makeArrows();
48+
49+
process.on('exit', function(code) {
50+
if (code === 1) {
51+
throw new Error('makeArrows failed.');
52+
}
53+
});

src/locales/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import en from './en';
2+
import xx from './xx';
23

34
export default {
45
en: en,
6+
xx: xx
57
};

src/locales/xx.js

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
export default {
2+
'Anchor Point': '⇚⇚Anchor Point⇚⇚',
3+
Angle: '⇚Angle⇚',
4+
Annotation: '⇚⇚Annotation⇚⇚',
5+
Arrow: '⇚Arrow⇚',
6+
Arrowhead: '⇚⇚Arrowhead⇚⇚',
7+
Auto: '⇚Auto⇚',
8+
Autoscale: '⇚⇚Autoscale⇚⇚',
9+
Axes: '⇚Axes⇚',
10+
'Background Color': '⇚⇚⇚Background Color⇚⇚⇚',
11+
'Bar Padding': '⇚⇚Bar Padding⇚⇚',
12+
'Bar Width': '⇚⇚Bar Width⇚⇚',
13+
Bars: '⇚Bars⇚',
14+
Blank: '⇚Blank⇚',
15+
'Border Color': '⇚⇚Border Color⇚⇚',
16+
'Border Width': '⇚⇚Border Width⇚⇚',
17+
Bottom: '⇚Bottom⇚',
18+
'Box Padding': '⇚⇚Box Padding⇚⇚',
19+
'Box Select': '⇚⇚Box Select⇚⇚',
20+
'Box Width': '⇚⇚Box Width⇚⇚',
21+
Canvas: '⇚Canvas⇚',
22+
Center: '⇚Center⇚',
23+
'Click to enter Colorscale title': '⇚⇚⇚⇚⇚Click to enter Colorscale title⇚⇚⇚⇚⇚',
24+
'Click to enter Component A title': '⇚⇚⇚⇚⇚⇚Click to enter Component A title⇚⇚⇚⇚⇚⇚',
25+
'Click to enter Component B title': '⇚⇚⇚⇚⇚⇚Click to enter Component B title⇚⇚⇚⇚⇚⇚',
26+
'Click to enter Component C title': '⇚⇚⇚⇚⇚⇚Click to enter Component C title⇚⇚⇚⇚⇚⇚',
27+
'Click to enter Plot title': '⇚⇚⇚⇚Click to enter Plot title⇚⇚⇚⇚',
28+
'Click to enter X axis title': '⇚⇚⇚⇚⇚Click to enter X axis title⇚⇚⇚⇚⇚',
29+
'Click to enter Y axis title': '⇚⇚⇚⇚⇚Click to enter Y axis title⇚⇚⇚⇚⇚',
30+
Color: '⇚Color⇚',
31+
'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.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
32+
'Compare data on hover': '⇚⇚⇚⇚Compare data on hover⇚⇚⇚⇚',
33+
Connect: '⇚Connect⇚',
34+
'Connect Gaps': '⇚⇚Connect Gaps⇚⇚',
35+
Continue: '⇚Continue⇚',
36+
'Continuing will convert your LaTeX expression into raw text.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚Continuing will convert your LaTeX expression into raw text.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
37+
'Continuing will convert your note to LaTeX-style text.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚Continuing will convert your note to LaTeX-style text.⇚⇚⇚⇚⇚⇚⇚⇚⇚',
38+
'Continuing will remove your expression.': '⇚⇚⇚⇚⇚⇚⇚Continuing will remove your expression.⇚⇚⇚⇚⇚⇚⇚',
39+
Custom: '⇚Custom⇚',
40+
'Custom Color': '⇚⇚Custom Color⇚⇚',
41+
'Default Colors': '⇚⇚Default Colors⇚⇚',
42+
Display: '⇚Display⇚',
43+
'Double-click on legend to isolate one trace': '⇚⇚⇚⇚⇚⇚⇚⇚Double-click on legend to isolate one trace⇚⇚⇚⇚⇚⇚⇚⇚',
44+
'Double-click to zoom back out': '⇚⇚⇚⇚⇚Double-click to zoom back out⇚⇚⇚⇚⇚',
45+
'Download plot as a png': '⇚⇚⇚⇚Download plot as a png⇚⇚⇚⇚',
46+
'Edit in Chart Studio': '⇚⇚⇚⇚Edit in Chart Studio⇚⇚⇚⇚',
47+
'Edit in HTML': '⇚⇚Edit in HTML⇚⇚',
48+
'Edit in Rich Text': '⇚⇚⇚Edit in Rich Text⇚⇚⇚',
49+
'Enter Link URL': '⇚⇚Enter Link URL⇚⇚',
50+
'Filled Area': '⇚⇚Filled Area⇚⇚',
51+
'Fixed Height': '⇚⇚Fixed Height⇚⇚',
52+
'Fixed Width': '⇚⇚Fixed Width⇚⇚',
53+
'Font Color': '⇚⇚Font Color⇚⇚',
54+
'Font Size': '⇚⇚Font Size⇚⇚',
55+
'Global Font': '⇚⇚Global Font⇚⇚',
56+
'Go back': '⇚Go back⇚',
57+
'Go to the \'Create\' tab to define traces.': '⇚⇚⇚⇚⇚⇚⇚Go to the \'Create\' tab to define traces.⇚⇚⇚⇚⇚⇚⇚',
58+
'Heads up!': '⇚⇚Heads up!⇚⇚',
59+
Hide: '⇚Hide⇚',
60+
Horizontal: '⇚⇚Horizontal⇚⇚',
61+
'Horizontal Positioning': '⇚⇚⇚⇚Horizontal Positioning⇚⇚⇚⇚',
62+
'IE only supports svg. Changing format to svg.': '⇚⇚⇚⇚⇚⇚⇚⇚IE only supports svg. Changing format to svg.⇚⇚⇚⇚⇚⇚⇚⇚',
63+
LaTeX: '⇚LaTeX⇚',
64+
'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.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
65+
'Lasso Select': '⇚⇚Lasso Select⇚⇚',
66+
Layout: '⇚Layout⇚',
67+
Left: '⇚Left⇚',
68+
Legend: '⇚Legend⇚',
69+
'Legend Box': '⇚⇚Legend Box⇚⇚',
70+
'Line Color': '⇚⇚Line Color⇚⇚',
71+
'Line Width': '⇚⇚Line Width⇚⇚',
72+
Linear: '⇚Linear⇚',
73+
Lines: '⇚Lines⇚',
74+
'Looks like there aren\'t any traces defined yet.': '⇚⇚⇚⇚⇚⇚⇚⇚Looks like there aren\'t any traces defined yet.⇚⇚⇚⇚⇚⇚⇚⇚',
75+
'Margin Color': '⇚⇚Margin Color⇚⇚',
76+
'Margins and Padding': '⇚⇚⇚Margins and Padding⇚⇚⇚',
77+
Max: '⇚Max⇚',
78+
Middle: '⇚Middle⇚',
79+
Min: '⇚Min⇚',
80+
'Multiple Values': '⇚⇚⇚Multiple Values⇚⇚⇚',
81+
Normal: '⇚Normal⇚',
82+
'Note Text': '⇚⇚Note Text⇚⇚',
83+
Notes: '⇚Notes⇚',
84+
Opacity: '⇚Opacity⇚',
85+
'Orbital rotation': '⇚⇚⇚Orbital rotation⇚⇚⇚',
86+
Orientation: '⇚⇚Orientation⇚⇚',
87+
Padding: '⇚Padding⇚',
88+
Pan: '⇚Pan⇚',
89+
'Plot Background': '⇚⇚⇚Plot Background⇚⇚⇚',
90+
Points: '⇚Points⇚',
91+
Position: '⇚Position⇚',
92+
Positioning: '⇚⇚Positioning⇚⇚',
93+
'Produced with Plotly': '⇚⇚⇚⇚Produced with Plotly⇚⇚⇚⇚',
94+
Range: '⇚Range⇚',
95+
'Relative To': '⇚⇚Relative To⇚⇚',
96+
Reset: '⇚Reset⇚',
97+
'Reset axes': '⇚⇚Reset axes⇚⇚',
98+
'Reset camera to default': '⇚⇚⇚⇚Reset camera to default⇚⇚⇚⇚',
99+
'Reset camera to last save': '⇚⇚⇚⇚Reset camera to last save⇚⇚⇚⇚',
100+
'Reset view': '⇚⇚Reset view⇚⇚',
101+
'Reset views': '⇚⇚Reset views⇚⇚',
102+
'Return to the Graph > Create menu above to add data.': '⇚⇚⇚⇚⇚⇚⇚⇚⇚Return to the Graph > Create menu above to add data.⇚⇚⇚⇚⇚⇚⇚⇚⇚',
103+
Reversed: '⇚Reversed⇚',
104+
'Rich Text': '⇚⇚Rich Text⇚⇚',
105+
'Rich text is incompatible with LaTeX.': '⇚⇚⇚⇚⇚⇚Rich text is incompatible with LaTeX.⇚⇚⇚⇚⇚⇚',
106+
Right: '⇚Right⇚',
107+
Scale: '⇚Scale⇚',
108+
Selection: '⇚⇚Selection⇚⇚',
109+
Shape: '⇚Shape⇚',
110+
Show: '⇚Show⇚',
111+
'Show closest data on hover': '⇚⇚⇚⇚⇚Show closest data on hover⇚⇚⇚⇚⇚',
112+
Size: '⇚Size⇚',
113+
'Size and Spacing': '⇚⇚⇚Size and Spacing⇚⇚⇚',
114+
'Snapshot succeeded': '⇚⇚⇚Snapshot succeeded⇚⇚⇚',
115+
'Sorry, there was a problem downloading your snapshot!': '⇚⇚⇚⇚⇚⇚⇚⇚⇚Sorry, there was a problem downloading your snapshot!⇚⇚⇚⇚⇚⇚⇚⇚⇚',
116+
Symbol: '⇚Symbol⇚',
117+
'Taking snapshot - this may take a few seconds': '⇚⇚⇚⇚⇚⇚⇚⇚Taking snapshot - this may take a few seconds⇚⇚⇚⇚⇚⇚⇚⇚',
118+
Text: '⇚Text⇚',
119+
'Text Attributes': '⇚⇚⇚Text Attributes⇚⇚⇚',
120+
'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.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
121+
'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.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
122+
'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.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
123+
'This trace does not yet have any data.': '⇚⇚⇚⇚⇚⇚⇚This trace does not yet have any data.⇚⇚⇚⇚⇚⇚⇚',
124+
'Tick Labels': '⇚⇚Tick Labels⇚⇚',
125+
'Tick Markers': '⇚⇚Tick Markers⇚⇚',
126+
Title: '⇚Title⇚',
127+
'Title and Fonts': '⇚⇚⇚Title and Fonts⇚⇚⇚',
128+
Titles: '⇚Titles⇚',
129+
'Toggle Spike Lines': '⇚⇚⇚Toggle Spike Lines⇚⇚⇚',
130+
'Toggle show closest data on hover': '⇚⇚⇚⇚⇚⇚Toggle show closest data on hover⇚⇚⇚⇚⇚⇚',
131+
Top: '⇚Top⇚',
132+
Trace: '⇚Trace⇚',
133+
'Trace Order': '⇚⇚Trace Order⇚⇚',
134+
'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.⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚⇚',
135+
'Turntable rotation': '⇚⇚⇚Turntable rotation⇚⇚⇚',
136+
Type: '⇚Type⇚',
137+
Typeface: '⇚Typeface⇚',
138+
URL: '⇚URL⇚',
139+
Vertical: '⇚Vertical⇚',
140+
'Vertical Positioning': '⇚⇚⇚⇚Vertical Positioning⇚⇚⇚⇚',
141+
Width: '⇚Width⇚',
142+
'X Position': '⇚⇚X Position⇚⇚',
143+
'X Vector': '⇚X Vector⇚',
144+
'Y Position': '⇚⇚Y Position⇚⇚',
145+
'Y Vector': '⇚Y Vector⇚',
146+
Zoom: '⇚Zoom⇚',
147+
'Zoom Interactivity': '⇚⇚⇚Zoom Interactivity⇚⇚⇚',
148+
'Zoom in': '⇚Zoom in⇚',
149+
'Zoom out': '⇚Zoom out⇚',
150+
'close:': '⇚close:⇚',
151+
'high:': '⇚high:⇚',
152+
'incoming flow count:': '⇚⇚⇚⇚incoming flow count:⇚⇚⇚⇚',
153+
'kde:': '⇚kde:⇚',
154+
'lat:': '⇚lat:⇚',
155+
log: '⇚log⇚',
156+
'lon:': '⇚lon:⇚',
157+
'low:': '⇚low:⇚',
158+
'lower fence:': '⇚⇚lower fence:⇚⇚',
159+
'max:': '⇚max:⇚',
160+
'mean ± σ:': '⇚⇚mean ± σ:⇚⇚',
161+
'mean:': '⇚mean:⇚',
162+
'median:': '⇚median:⇚',
163+
'min:': '⇚min:⇚',
164+
'open:': '⇚open:⇚',
165+
'outgoing flow count:': '⇚⇚⇚⇚outgoing flow count:⇚⇚⇚⇚',
166+
'q1:': '⇚q1:⇚',
167+
'q3:': '⇚q3:⇚',
168+
'source:': '⇚source:⇚',
169+
'target:': '⇚target:⇚',
170+
trace: '⇚trace⇚',
171+
'upper fence:': '⇚⇚upper fence:⇚⇚'
172+
}

0 commit comments

Comments
 (0)