Skip to content

Commit 599dff9

Browse files
authored
Merge pull request #2195 from plotly/i18n
Localization
2 parents 6b4b892 + 9708b56 commit 599dff9

File tree

95 files changed

+881
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+881
-381
lines changed

dist/plotly-locale-en-us.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plotly-locale-en.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/translation-keys.txt

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Autoscale // components/modebar/buttons.js:139
2+
Box Select // components/modebar/buttons.js:103
3+
Click to enter Colorscale title // plots/plots.js:437
4+
Click to enter Component A title // plots/ternary/ternary.js:386
5+
Click to enter Component B title // plots/ternary/ternary.js:400
6+
Click to enter Component C title // plots/ternary/ternary.js:411
7+
Click to enter Plot title // plot_api/plot_api.js:579
8+
Click to enter X axis title // plots/plots.js:435
9+
Click to enter Y axis title // plots/plots.js:436
10+
Compare data on hover // components/modebar/buttons.js:167
11+
Double-click on legend to isolate one trace // components/legend/handle_click.js:90
12+
Double-click to zoom back out // plots/cartesian/dragbox.js:299
13+
Download plot as a png // components/modebar/buttons.js:52
14+
Edit in Chart Studio // components/modebar/buttons.js:76
15+
IE only supports svg. Changing format to svg. // components/modebar/buttons.js:60
16+
Lasso Select // components/modebar/buttons.js:112
17+
Orbital rotation // components/modebar/buttons.js:279
18+
Pan // components/modebar/buttons.js:94
19+
Produced with Plotly // components/modebar/modebar.js:256
20+
Reset // components/modebar/buttons.js:432
21+
Reset axes // components/modebar/buttons.js:148
22+
Reset camera to default // components/modebar/buttons.js:314
23+
Reset camera to last save // components/modebar/buttons.js:322
24+
Reset view // components/modebar/buttons.js:583
25+
Reset views // components/modebar/buttons.js:529
26+
Show closest data on hover // components/modebar/buttons.js:157
27+
Snapshot succeeded // components/modebar/buttons.js:66
28+
Sorry, there was a problem downloading your snapshot! // components/modebar/buttons.js:69
29+
Taking snapshot - this may take a few seconds // components/modebar/buttons.js:57
30+
Toggle Spike Lines // components/modebar/buttons.js:548
31+
Toggle show closest data on hover // components/modebar/buttons.js:353
32+
Turntable rotation // components/modebar/buttons.js:288
33+
Zoom // components/modebar/buttons.js:85
34+
Zoom in // components/modebar/buttons.js:121
35+
Zoom out // components/modebar/buttons.js:130
36+
close: // traces/ohlc/transform.js:139
37+
high: // traces/ohlc/transform.js:137
38+
incoming flow count: // traces/sankey/plot.js:142
39+
kde: // traces/violin/calc.js:73
40+
lat: // traces/scattergeo/calc.js:48
41+
lon: // traces/scattergeo/calc.js:49
42+
low: // traces/ohlc/transform.js:138
43+
lower fence: // traces/box/calc.js:134
44+
max: // traces/box/calc.js:132
45+
mean ± σ: // traces/box/calc.js:133
46+
mean: // traces/box/calc.js:133
47+
median: // traces/box/calc.js:128
48+
min: // traces/box/calc.js:129
49+
open: // traces/ohlc/transform.js:136
50+
outgoing flow count: // traces/sankey/plot.js:143
51+
q1: // traces/box/calc.js:130
52+
q3: // traces/box/calc.js:131
53+
source: // traces/sankey/plot.js:140
54+
target: // traces/sankey/plot.js:141
55+
trace // plots/plots.js:439
56+
upper fence: // traces/box/calc.js:135

lib/index-basic.js

+6
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ Plotly.register([
1515
require('./pie')
1616
]);
1717

18+
// locales
19+
Plotly.register([
20+
require('./locale-en'),
21+
require('./locale-en-us')
22+
]);
23+
1824
module.exports = Plotly;

lib/index-cartesian.js

+6
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,10 @@ Plotly.register([
2323
require('./violin')
2424
]);
2525

26+
// locales
27+
Plotly.register([
28+
require('./locale-en'),
29+
require('./locale-en-us')
30+
]);
31+
2632
module.exports = Plotly;

lib/index-finance.js

+6
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ Plotly.register([
1818
require('./candlestick')
1919
]);
2020

21+
// locales
22+
Plotly.register([
23+
require('./locale-en'),
24+
require('./locale-en-us')
25+
]);
26+
2127
module.exports = Plotly;

lib/index-geo.js

+6
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ Plotly.register([
1515
require('./choropleth')
1616
]);
1717

18+
// locales
19+
Plotly.register([
20+
require('./locale-en'),
21+
require('./locale-en-us')
22+
]);
23+
1824
module.exports = Plotly;

lib/index-gl2d.js

+6
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ Plotly.register([
1818
require('./parcoords')
1919
]);
2020

21+
// locales
22+
Plotly.register([
23+
require('./locale-en'),
24+
require('./locale-en-us')
25+
]);
26+
2127
module.exports = Plotly;

lib/index-gl3d.js

+6
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ Plotly.register([
1616
require('./mesh3d')
1717
]);
1818

19+
// locales
20+
Plotly.register([
21+
require('./locale-en'),
22+
require('./locale-en-us')
23+
]);
24+
1925
module.exports = Plotly;

lib/index-mapbox.js

+6
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@ Plotly.register([
1414
require('./scattermapbox')
1515
]);
1616

17+
// locales
18+
Plotly.register([
19+
require('./locale-en'),
20+
require('./locale-en-us')
21+
]);
22+
1723
module.exports = Plotly;

lib/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,10 @@ Plotly.register([
7171
require('./calendars')
7272
]);
7373

74+
// locales
75+
Plotly.register([
76+
require('./locale-en.js'),
77+
require('./locale-en-us.js')
78+
]);
79+
7480
module.exports = Plotly;

lib/locale-en-us.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright 2012-2017, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
module.exports = {
12+
moduleType: 'locale',
13+
name: 'en-US',
14+
dictionary: {
15+
'Click to enter Colorscale title': 'Click to enter Colorscale title'
16+
}
17+
};

lib/locale-en.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright 2012-2017, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
module.exports = {
12+
moduleType: 'locale',
13+
name: 'en',
14+
dictionary: {
15+
'Click to enter Colorscale title': 'Click to enter Colourscale title'
16+
}
17+
};

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"bundle": "node tasks/bundle.js",
2626
"header": "node tasks/header.js",
2727
"stats": "node tasks/stats.js",
28-
"build": "npm run preprocess && npm run bundle && npm run header && npm run stats",
28+
"find-strings": "node tasks/find_locale_strings.js",
29+
"build": "npm run preprocess && npm run find-strings && npm run bundle && npm run header && npm run stats",
2930
"cibuild": "npm run preprocess && node tasks/cibundle.js",
3031
"watch": "node tasks/watch.js",
3132
"lint": "eslint --version && eslint .",
@@ -36,7 +37,7 @@
3637
"test-image": "node tasks/test_image.js",
3738
"test-image-gl2d": "node tasks/test_image.js gl2d_* --queue",
3839
"test-export": "node tasks/test_export.js",
39-
"test-syntax": "node tasks/test_syntax.js",
40+
"test-syntax": "node tasks/test_syntax.js && npm run find-strings",
4041
"test-bundle": "node tasks/test_bundle.js",
4142
"test": "npm run test-jasmine && npm run test-bundle && npm run test-image && npm run test-image-gl2d && npm run test-syntax && npm run lint",
4243
"start-test_dashboard": "node devtools/test_dashboard/server.js",
@@ -121,6 +122,7 @@
121122
"glslify": "^4.0.0",
122123
"gzip-size": "^3.0.0",
123124
"image-size": "^0.5.1",
125+
"into-stream": "^3.1.0",
124126
"jasmine-core": "^2.4.1",
125127
"jsdom": "^11.2.0",
126128
"karma": "^1.5.0",

src/components/colorbar/attributes.js

-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ module.exports = overrideAll({
177177
title: {
178178
valType: 'string',
179179
role: 'info',
180-
dflt: 'Click to enter colorscale title',
181180
description: 'Sets the title of the color bar.'
182181
},
183182
titlefont: fontAttrs({

src/components/colorbar/defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) {
5959
handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear',
6060
{outerTicks: false, font: layout.font, noHover: true});
6161

62-
coerce('title');
62+
coerce('title', layout._dfltTitle.colorbar);
6363
Lib.coerceFont(coerce, 'titlefont', layout.font);
6464
coerce('titleside');
6565
};

src/components/colorbar/draw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ module.exports = function draw(gd, id) {
455455
propContainer: cbAxisOut,
456456
propName: propName,
457457
traceIndex: trace.index,
458-
dfltName: 'colorscale',
458+
placeholder: fullLayout._dfltTitle.colorbar,
459459
containerGroup: container.select('.cbtitle')
460460
};
461461

src/components/legend/handle_click.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ module.exports = function handleClick(g, gd, numClicks) {
8787
}
8888

8989
if(numClicks === 1 && SHOWISOLATETIP && gd.data && gd._context.showTips) {
90-
Lib.notifier('Double click on legend to isolate individual trace', 'long');
90+
Lib.notifier(Lib._(gd, 'Double-click on legend to isolate one trace'), 'long');
9191
SHOWISOLATETIP = false;
9292
} else {
9393
SHOWISOLATETIP = false;

0 commit comments

Comments
 (0)