版權聲明:本文爲博主原創文章,未經博主允許不得轉載。 https://blog.csdn.net/u011007991/article/details/70230916
前言
OpenWRT 的多語言支持此處只介紹中英文支持,首先OpenWRT的多語言支持其實就是由一箇中文/英文相對應的文本列表實現
- 其格式如下所示
msgid "(%d minute window, %d second interval)"
msgstr "(%d分鐘信息,%d秒刷新)"
msgid "Firmware is downloading..."
msgstr "固件下載中..."
msgid "Download Progress"
msgstr "下載進度"
msgid "Online Upgrade Firmware"
msgstr "在線升級固件"
msgid "Current Version"
msgstr "當前固件版本"
實現步驟
準備如上格式的文本文件命名爲base.zh-cn.po,由於OpenWRT中只識別格式爲lmo格式的緊湊型文本格式,因此我們必須藉助程序po2lmo
(該文件可以在~/op-0-3-8/package/openwrt-dist-luci/files/luci/tools/po2lmo中找到)使用po2lmo base.zh-cn.po /op-0-3-8/files/usr/lib/lua/luci/i18n/base.zh-cn.lmo
代碼實現
_("Current Version")