zabbix 界面翻译不完全的处理

zabbix是一个多语言监控系统,界面显示由对应的语言下的frontend.mo控制。当前对中文的翻译不完全,如下图

image

如果我们需要自己优化,将此翻译成中文,那么你需要修改zh_CN下的frontend.po,然后make_mo.sh创建frontend.mo。下面以

image

为例,介绍zabbix界面的汉化过程。

汉化例子

1、确认要修改的po文件的位置
复制代码
[root@zabbix ~]# find / -name frontend.po
/root/cn_LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/bg/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/cs/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/de/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/el/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/en_US/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/es/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/fa/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/fi/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/fr/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/hu/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/id/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/it/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/ja/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/ko/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/lt/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/lv/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/nl/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/pl/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/pt_BR/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/pt_PT/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/ro/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/ru/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/sk/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/sv/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/tr/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/uk/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/vi/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/zh_CN/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/zh_TW/LC_MESSAGES/frontend.po
/usr/share/zabbix/locale/ka/LC_MESSAGES/frontend.po
复制代码
2、添加中文内容到frontend.po
[root@zabbix LC_MESSAGES]# vim frontend.po

#: include/blocks.inc.php:486
msgid "Number of items (enabled/disabled/not supported)"
msgstr ""

修改为

#: include/blocks.inc.php:486
msgid "Number of items (enabled/disabled/not supported)"
msgstr "监控项(启用/禁用/不支持)"
3、创建.mo文件
/usr/share/zabbix/locale/make_mo.sh
4、刷新界面,发现已经变成了中文

image

po文件编辑工具推荐---Poedit

使用vim编辑frontend.po是一种办法,也可以使用专门的图形化工具Poedit对po文件进行编辑、编译。该工具具有翻译建议
image2、
将生成的frontend.mo替换掉/usr/share/zabbix/locale/zh_CN/LC_MESSAGES下的frontend.po 即可。

gettext工具简介

zabbix提供的脚本 /usr/share/zabbix/locale/make_mo.sh 实现语言文件po到mo的转换,其实/usr/share/zabbix/locale/make_mo.sh调用的就是gettext中的gettext。

[root@zabbix locale]# cat /usr/share/zabbix/locale/make_mo.sh
#!/bin/bash

while read pofile; do
        msgfmt --use-fuzzy -c -o ${pofile%po}mo $pofile
done < <(find $(dirname $0) -type f ! -wholename '*/.svn*' -name '*.po')

gettext工具下载地址:http://gnuwin32.sourceforge.net/packages/gettext.htm

gettext包中包含了msgunfmt.exe、msgfmt.exe 等文件,可以实现语言文件po和mo的互相转换

根据po生成mo

重新生成mo文件
cd  C:\Software\GetText\bin
msgfmt.exe         C:\Users\xqzt\Desktop\当前\frontend.po  -o C:\Users\xqzt\Desktop\当前\frontend.mo

根据mo生成po

cd  C:\Software\GetText\bin
msgunfmt.exe     C:\Users\xqzt\Desktop\frontend.mo    -o C:\Users\xqzt\Desktop\frontend.po

posted on   小强斋太  阅读(3533)  评论(0编辑  收藏  举报

编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2015-04-29 为准确生成执行计划更新统计信息-analyze与dbms_stats
2015-04-29 索引跳跃式扫描(INDEX SKIP SCAN)
2015-04-29 索引快速扫描(index fast full scan)
2015-04-29 索引全扫描(INDEX FULL SCAN)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示

目录导航