Superset
Apache Superset是一款由Python语言为主开发的开源时髦数据探索分析以及可视化的报表平台;她支持丰富的数据源,且拥有多姿多彩的可视化图表选择。
- 官网 :superset.apache.org/
- github :github.com/apache/supe…
- 国内支持的镜像站 :阿里云:mirrors.aliyun.com/pypi/simple… 等
- 开发语言:Python为主
安装
最简单的安装方式是使用docker-compose
官方给出了安装的方法,参考链接
# 拉取代码
git clone https://github.com/apache/superset.git
# 进入代码的文件夹
cd superset
# 使用docker-compose 拉取镜像,并启动服务
docker compose -f docker-compose-image-tag.yml up -d
然后通过 8088端口,即可访问 superset
汉化
Superset的页面都是英文的,这里需要进行汉化。但是网络上搜索的都是比较老的教程。不是针对Docker-compose这种安装方式的
汉化主要依赖修改的文件是两个。
代码目录下
- superset/config.py
- superset/translations/zh 文件夹
- docker-compose-image-tag.yml
superset/config.py 文件修改配置
vi superset/config.py
找到BABEL_DEFAULT_LOCALE 修改为 zh
superset/translations/zh 编译汉化内容
apt-get update
apt-get install python3-babel
cd superset
pybabel compile -d translations
编译中文的会出错,需要对文件进行修改
编辑translations/zh/LC_MESSAGES/messages.po 文件。
msgid 是英文消息。
msgstr 是翻译后的中文消息。
这两个消息是类似Key和Value的形式。两个消息中有一些占位符,需要保持中文消息中的占位符与英文消息的占位符形式一致。
参考这个pull requests 的修改
编译成功后,会生成 translations/zh/LC_MESSAGES/messages.mo 文件
docker-compose-image-tag.yml 增加文件映射
增加的映射是上图框出来的部分。
重启应用
docker compose -f docker-compose-image-tag.yml down
docker compose -f docker-compose-image-tag.yml up -d
汉化后的界面
可以看到页面上方的文字已经汉化,但是下面页面中的文字还没汉化,这部分估计是写死在代码中的,需要深度汉化。