Skip to content

Commit

Permalink
describe localization in dist/README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcjohnson committed Dec 18, 2017
1 parent 614d5be commit 331b2da
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 9 deletions.
34 changes: 29 additions & 5 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,46 @@ or the un-minified version as:
<script type="text/javascript" src="plotly.js" charset="utf-8"></script>
```

To support IE9, put:
### To support IE9

*Before* the plotly.js script tag, add:

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

before the plotly.js script tag.
### To support MathJax

To add MathJax, put
*Before* the plotly.js script tag, add:

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

before the plotly.js script tag. You can grab the relevant MathJax files in `./dist/extras/mathjax/`.
You can grab the relevant MathJax files in `./dist/extras/mathjax/`.

### To include localization

Plotly.js defaults to US English (en-US) and includes British English (en) in the standard bundle.
Many other localizations are available - here is an example using Swiss-German (de-CH),
see the contents of this directory for the full list.
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
Note that the file names are all lowercase, even though the region is uppercase when you apply a locale.

*After* the plotly.js script tag, add:

```html
<script type="text/javascript" src="plotly-locale-de-ch.js"></script>
<script type="text/javascript">Plotly.setPlotConfig({locale: 'de-CH'})</script>
```

The first line loads and registers the locale definition with plotly.js, the second sets it as the default for all Plotly plots.
You can also include multiple locale definitions and apply them to each plot separately as a `config` parameter:

```js
Plotly.newPlot(graphDiv, data, layout, {locale: 'de-CH'})
```

# Bundle information

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

### plotly.js cartesian

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

| Way to import | Location |
|---------------|----------|
Expand Down
32 changes: 28 additions & 4 deletions tasks/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,46 @@ function getInfoContent() {
'<script type="text/javascript" src="plotly.js" charset="utf-8"></script>',
'```',
'',
'To support IE9, put:',
'### To support IE9',
'',
'*Before* the plotly.js script tag, add:',
'',
'```html',
'<script>if(typeof window.Int16Array !== \'function\')document.write("<scri"+"pt src=\'extras/typedarray.min.js\'></scr"+"ipt>");</script>',
'<script>document.write("<scri"+"pt src=\'extras/request_animation_frame.js\'></scr"+"ipt>");</script>',
'```',
'',
'before the plotly.js script tag.',
'### To support MathJax',
'',
'To add MathJax, put',
'*Before* the plotly.js script tag, add:',
'',
'```html',
'<script type="text/javascript" src="mathjax/MathJax.js?config=TeX-AMS-MML_SVG"></script>',
'```',
'',
'before the plotly.js script tag. You can grab the relevant MathJax files in `./dist/extras/mathjax/`.',
'You can grab the relevant MathJax files in `./dist/extras/mathjax/`.',
'',
'### To include localization',
'',
'Plotly.js defaults to US English (en-US) and includes British English (en) in the standard bundle.',
'Many other localizations are available - here is an example using Swiss-German (de-CH),',
'see the contents of this directory for the full list.',
'They are also available on our CDN as ' + cdnRoot + 'locale-de-ch-latest.js OR ' + cdnRoot + 'locale-de-ch-' + pkg.version + '.js',
'Note that the file names are all lowercase, even though the region is uppercase when you apply a locale.',
'',
'*After* the plotly.js script tag, add:',
'',
'```html',
'<script type="text/javascript" src="plotly-locale-de-ch.js"></script>',
'<script type="text/javascript">Plotly.setPlotConfig({locale: \'de-CH\'})</script>',
'```',
'',
'The first line loads and registers the locale definition with plotly.js, the second sets it as the default for all Plotly plots.',
'You can also include multiple locale definitions and apply them to each plot separately as a `config` parameter:',
'',
'```js',
'Plotly.newPlot(graphDiv, data, layout, {locale: \'de-CH\'})',
'```',
''
];
}
Expand Down

0 comments on commit 331b2da

Please sign in to comment.