write_html: locale config does not work
未关闭
还没有人认领这个 Issue。
bug
P3
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
Hi!
I'm using plotly to generate a standalone HTML-file that contains only my plot. I do want the axes to be localized in German (one axis has Dates).
This code does not work:
fig.write_html("index.html",
include_plotlyjs="cdn",
config={"locale": "de"}
)
The reason is that the following line is missing in the generated HTML-file (cf. plotly.js documentation)
<script src="https://cdn.plot.ly/plotly-locale-de-latest.js"></script>
I suggest to add a locale argument to the write_html function that does two things (think of de as exchangeable):
- it adds the missing localization file somewhere here
- it adds
"locale": "de"to the plotconfig
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 packages/python/plotly/plotly/io/_html.py 第 345 行附近开始,跟踪 write_html 如何构建独立的 HTML 和绘图配置。使用德语 locale 验证该示例,然后确保生成的文档加载 locale 脚本,并将请求的 locale 应用到绘图配置中。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, python
- 领域
- data-visualization, web-dev
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100