Skip to content

Commit 331b2da

Browse files
committed
describe localization in dist/README.md
1 parent 614d5be commit 331b2da

File tree

2 files changed

+57
-9
lines changed

2 files changed

+57
-9
lines changed

dist/README.md

+29-5
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,46 @@ or the un-minified version as:
1414
<script type="text/javascript" src="plotly.js" charset="utf-8"></script>
1515
```
1616

17-
To support IE9, put:
17+
### To support IE9
18+
19+
*Before* the plotly.js script tag, add:
1820

1921
```html
2022
<script>if(typeof window.Int16Array !== 'function')document.write("<scri"+"pt src='extras/typedarray.min.js'></scr"+"ipt>");</script>
2123
<script>document.write("<scri"+"pt src='extras/request_animation_frame.js'></scr"+"ipt>");</script>
2224
```
2325

24-
before the plotly.js script tag.
26+
### To support MathJax
2527

26-
To add MathJax, put
28+
*Before* the plotly.js script tag, add:
2729

2830
```html
2931
<script type="text/javascript" src="mathjax/MathJax.js?config=TeX-AMS-MML_SVG"></script>
3032
```
3133

32-
before the plotly.js script tag. You can grab the relevant MathJax files in `./dist/extras/mathjax/`.
34+
You can grab the relevant MathJax files in `./dist/extras/mathjax/`.
35+
36+
### To include localization
37+
38+
Plotly.js defaults to US English (en-US) and includes British English (en) in the standard bundle.
39+
Many other localizations are available - here is an example using Swiss-German (de-CH),
40+
see the contents of this directory for the full list.
41+
They are also available on our CDN as https://cdn.plot.ly/plotly-locale-de-ch-latest.js OR https://cdn.plot.ly/plotly-locale-de-ch-1.31.2.js
42+
Note that the file names are all lowercase, even though the region is uppercase when you apply a locale.
43+
44+
*After* the plotly.js script tag, add:
45+
46+
```html
47+
<script type="text/javascript" src="plotly-locale-de-ch.js"></script>
48+
<script type="text/javascript">Plotly.setPlotConfig({locale: 'de-CH'})</script>
49+
```
50+
51+
The first line loads and registers the locale definition with plotly.js, the second sets it as the default for all Plotly plots.
52+
You can also include multiple locale definitions and apply them to each plot separately as a `config` parameter:
53+
54+
```js
55+
Plotly.newPlot(graphDiv, data, layout, {locale: 'de-CH'})
56+
```
3357

3458
# Bundle information
3559

@@ -84,7 +108,7 @@ The `basic` partial bundle contains the `scatter`, `bar` and `pie` trace modules
84108

85109
### plotly.js cartesian
86110

87-
The `cartesian` partial bundle contains the `scatter`, `bar`, `box`, `heatmap`, `histogram`, `histogram2d`, `histogram2dcontour`, `pie`, `contour` and `scatterternary` trace modules.
111+
The `cartesian` partial bundle contains the `scatter`, `bar`, `box`, `heatmap`, `histogram`, `histogram2d`, `histogram2dcontour`, `pie`, `contour`, `scatterternary` and `violin` trace modules.
88112

89113
| Way to import | Location |
90114
|---------------|----------|

tasks/stats.js

+28-4
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,46 @@ function getInfoContent() {
6060
'<script type="text/javascript" src="plotly.js" charset="utf-8"></script>',
6161
'```',
6262
'',
63-
'To support IE9, put:',
63+
'### To support IE9',
64+
'',
65+
'*Before* the plotly.js script tag, add:',
6466
'',
6567
'```html',
6668
'<script>if(typeof window.Int16Array !== \'function\')document.write("<scri"+"pt src=\'extras/typedarray.min.js\'></scr"+"ipt>");</script>',
6769
'<script>document.write("<scri"+"pt src=\'extras/request_animation_frame.js\'></scr"+"ipt>");</script>',
6870
'```',
6971
'',
70-
'before the plotly.js script tag.',
72+
'### To support MathJax',
7173
'',
72-
'To add MathJax, put',
74+
'*Before* the plotly.js script tag, add:',
7375
'',
7476
'```html',
7577
'<script type="text/javascript" src="mathjax/MathJax.js?config=TeX-AMS-MML_SVG"></script>',
7678
'```',
7779
'',
78-
'before the plotly.js script tag. You can grab the relevant MathJax files in `./dist/extras/mathjax/`.',
80+
'You can grab the relevant MathJax files in `./dist/extras/mathjax/`.',
81+
'',
82+
'### To include localization',
83+
'',
84+
'Plotly.js defaults to US English (en-US) and includes British English (en) in the standard bundle.',
85+
'Many other localizations are available - here is an example using Swiss-German (de-CH),',
86+
'see the contents of this directory for the full list.',
87+
'They are also available on our CDN as ' + cdnRoot + 'locale-de-ch-latest.js OR ' + cdnRoot + 'locale-de-ch-' + pkg.version + '.js',
88+
'Note that the file names are all lowercase, even though the region is uppercase when you apply a locale.',
89+
'',
90+
'*After* the plotly.js script tag, add:',
91+
'',
92+
'```html',
93+
'<script type="text/javascript" src="plotly-locale-de-ch.js"></script>',
94+
'<script type="text/javascript">Plotly.setPlotConfig({locale: \'de-CH\'})</script>',
95+
'```',
96+
'',
97+
'The first line loads and registers the locale definition with plotly.js, the second sets it as the default for all Plotly plots.',
98+
'You can also include multiple locale definitions and apply them to each plot separately as a `config` parameter:',
99+
'',
100+
'```js',
101+
'Plotly.newPlot(graphDiv, data, layout, {locale: \'de-CH\'})',
102+
'```',
79103
''
80104
];
81105
}

0 commit comments

Comments
 (0)