Localization
See original GitHub issueHello 👋
I am having trouble with localization.
I have looked at plotly.js tests for some inspiration and I’ve seen that config.locale
and config.locales
are being set here and passed to newPlot
fn. But it didn’t really help me.
My Chart components looks like this:
import * as Plotly from 'plotly.js'
import * as csDictionary from 'plotly.js/lib/locales/cs.js'
import * as React from 'react'
import * as Plot from 'react-plotly.js'
Plotly.register(csDictionary)
Plotly.setPlotConfig({ locale: 'cs' })
const trace1 = {
x: [0, 1, 2],
y: [1, 1, 1],
mode: 'lines+markers+text',
name: 'Lines, Markers and Text',
text: ['Text A', 'Text B', 'Text C'],
textposition: 'top right',
textfont: {
family: 'sans serif',
size: 18,
color: '#1f77b4',
},
type: 'scatter',
}
class Chart extends React.Component {
render() {
return (
<Plot
config={{ locale: 'cs' }}
data={[trace1]}
layout={{
width: 800,
height: 400,
title: 'A Fancy Plot',
}}
/>
)
}
}
export default Chart
❓ Any ideas how to make this work?
Localization is crucial for me and it looks that it is somehow supported, but I just cannot figure how to set it up.
Thanks 🙏
Issue Analytics
- State:
- Created 5 years ago
- Comments:9
Top Results From Across the Web
Localization - Wikipedia
Language localization, translating a product into different languages or adapting a product to a country or region ; Internationalization and localization, the ...
Read more >What is localization? | Definition from TechTarget
Localization is the adaptation of a product or service to meet the needs of a particular language, culture or desired population's "look-and-feel.".
Read more >Everything You Need to Know About Localization - Smartling
Localization is the process of adapting a piece of content's full meaning for a new region, including translation, associated imagery, and cultural elements ......
Read more >LOCALIZATION definition | Cambridge English Dictionary
the process of organizing a business or industry so that its main activities happen in local areas rather than nationally or internationally: In...
Read more >What Is Localization, and How to Build a Strategy? | Phrase
Localization is the process of adapting a product or service to the culture and language of customers in a target market.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone still having this issue: after hours of struggling with this, having @conradoqg’s solution not work for me because of Webpack, I found an easy workaround.
At your top-level imports, do:
Notice you can import whatever Plotly-provided locale on the line above, and probably even create your own (following Plotly’s pre-defined dictionary structure for locales).
Then, inside your component definition, do:
Hope this helps, cheers!
Got it:
Cheers